ReplicateUsing does not call client on listen server

Hi!

I’m using ReplicateUsing=OnTestRecived (where “OnTestRecived” is my function) but only the clients are getting the call. I guess that’s because the server doesn’t need to replicate the value to its local clients so the callback is never called, right?

I could use a RPC call but as mentioned in the blueprint tutorial there are some potential problems with this method because “Network Relevancy” may cull some irrelevant data. What I want is to replicate a state but I need some custom logic when that value change, how can I achieve this in C++ without doing an ugly hack.

1 Like

Hi Undercover,

That is correct, the server won’t execute replication notifications locally since the server isn’t receiving any property updates, only sending them to clients.

Replication notifications will only trigger on a client that received a property from the server and that property changed as well.

This should be all you need need for clients to react to property changes that occur due to the server replicating these changes to the client.

If you also need the server to react to these changes, you can simply do that as soon as you change the values on the server.

Hope that makes sense :slight_smile:

1 Like

You are right that makes sense since hopefully all the relevant data are already known at the server side. Thanks again!

For interest, I think I recall hearing that, in code, you need to call the OnRep functions yourself server-side. But if you’re working in blueprints, they get called automatically.

That’s correct.