RepNotify from c++ confusion.

Ah just saw this thread again, apologies for missing your original question, TheJamsh!

Could you provide a little more detail here? Do you mean that the RepNotify functions aren’t called on the server? That’s a difference in C++ vs. blueprints, the RepNotify functions are not auto-called on the server/net-authority (and must be manually done, if desired). Or is there a client issue?

If you’re a listen server acting as the network authority, that is correct, the RepNotify’s won’t be called directly for you. An example use case here might be that you use the OnRep function purely for visuals (no gameplay relevance) and want that to happen for clients and the listen server, but not the dedicated server. In that case, you’d do something like this:



// Pretend this code is executing on the server, where I'm setting my replicated variable that has a repnotify setup on it (authority guarding it just to be clear/sure). Didn't compile this directly, just typed into the forums, so possible typos, etc.
if (Role == ROLE_Authority)
{
   bMyRepBool = true;
   if (GetNetMode() != NM_DedicatedServer)
   {
      OnRep_bMyRepBool();
   }
}


Another thing to be aware of is that it’s possible for the clients to also not call the OnReps, if their local value of the variable is already equal to the value the server replicates down. For that to happen, someone would likely have also locally modified the value on the client though, which is usually ill-advised. Even still, that behavior can also be changed by modifying how you setup your replication statement:



// This will cause the OnRep to always be called on the client, even if they have the same value locally already (usually don't need to do this, depends on your usage)
DOREPLIFETIME_CONDITION_NOTIFY(MyClass, MyVariable, COND_None, REPNOTIFY_Always);