I’m working on a Blueprint in Unreal Engine with a RepNotify variable. I thought that if you set a variable to its current value (i.e., it doesn’t actually change), it wouldn’t re-trigger the RepNotify function on the server (listen server).
However, it looks like in my case it does trigger again.
Am I misremembering how RepNotify works, is this expected behavior?
Example:
I went into my Player Character Pawn and created a boolean variable. I didn’t touch anything else, just added a Print String in the OnRep function. When I play the game and press Z several times on the server, the print executes every time (on the server, once on client), even though the variable isn’t actually changing.
Sorry for the confusion, it was just a quick set up to show what happened on var change on the server side specifically. As you say, the clients shouldn’t modify the replicated variable themselves, but rely on a ROS RPC custom event instead.
My surprise was on the rep notify function triggering multiple times on the server without the value really changing there.
The value is being set each key press, it’s just not re-transmitted to clients to save bandwidth.
You could cache the state on the server and then do a check