[4.10.4 & 4.11.P7] Inconsistent RepNotify behavior on client and server

Hi there!

Well it is neither a feature nor a bug, it is an inconsistent behavior of Blueprint RepNotify on client and host, that can cause unnecessary execution overhead or unexpected issues. Did not find anything about this issue in here.

Content Examples Sample Project for Unreal Engine | Unreal Engine 5.3 Documentation :

Oftentimes, it is desired to execute
some logic in response to the value of
a replicated variable changing.
Variables that are marked RepNotify,
have a special function called
automatically any time the value is
changed
, on both Network Authority
and Remote Machines.

So that means that OnRep only gets called if the variable is replicated by the authority.
And it means that it only gets called if the value has been changed.

That works for the client of course, but the host calls OnRep every time the variable is set (not even changed).
Further on as i can see when testing this issue: OnRep even gets called if the client itself sets the variable. No matter if changed as well. So you can run into a situation where the mix of Replication Event + Value Changed Event behaves completely opposite as intended.

It obviously means that the change-check is deep down the replication and not in the setter and that the OnRep call just happens when the variable is set.
=> You need to implement your own property setter to check for changes, before setting the rep property.

That OnRep gets called even if replication is not enabled for the blueprint, is a nice convenience feature i guess, but therefore i am sure you actually want to use it as change observer as well :slight_smile:

Tested this with 4.10.4 and 4.11.P7: Actor (with/without replication) - With a float variable - Set variable every Tick (with/without authority/remote check) - In OnRep do a PrintText of the variable (with authority/remote checks)

I did not realize that since 4.8. At least i had no issues with that. I just realized it now when calling my own Property Changed Dispatcher in OnRep for calculating UI things… To actually… not scan the values every tick :slight_smile:

Happy Debugging :slight_smile:

Marooney

Hello Marooney,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. I see that you mention testing this in 4.10.4 and 4.11 p7, does this mean that you were able to reproduce this issue in a clean project, or did you upgrade the project that you were using?
  2. If you were able to do this with a clean project, could you provide a detailed list of steps to reproduce this issue on our end?
  3. Can you provide screen shots of any blueprints that may be involved?

Hi, sorry i usually do better than that, so here we go:

1: Create a new blank project (i reproduced this in both 4.10.4 and 4.11.p7)

2: Create a new Actor set it replicated and drag it into the level

3: - Create a float variable and set it RepNotify

4: - Tick and OnRep as following:

Scenario 1:

82181-repnotifytest1_tick.jpg

Result (every tick) (1 Player, authoritative):

LogBlueprintUserMessages: [NewBlueprint_75] 0
LogBlueprintUserMessages: [NewBlueprint_75] 0
LogBlueprintUserMessages: [NewBlueprint_75] 0
...

Its actually on SET and not on CHANGED :slight_smile: (Different to all the other clients where it gets called only once)

Scenario 2:

82183-repnotifytest2_tick.jpg

Result (every tick) (1 Player, dedicated):

LogBlueprintUserMessages: [NewBlueprint_75] Client 1: 0
LogBlueprintUserMessages: [NewBlueprint_75] Client 1: 0
LogBlueprintUserMessages: [NewBlueprint_75] Client 1: 0
...

Its not on REP (client is non authoritative) and not on CHANGED as well :slight_smile:

No issue to me, i will do a custom change check if required, just wanted to point this out :slight_smile:

Hello Marooney,

I was able to reproduce this issue on end. I have written up a report ( UE-28424) and I have submitted to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day

There is still no change on that