OnRep not called on Authority for C++ UPROPERTY which is set from Blueprint

In this question: OnRep Called on Authority in Blueprint But Not C++

It is explained that setting C++ UPROPERTY values in code does automatically call the OnRep function on the authority. This makes sense when the value is set from C++, as the user is always free to call the function themselves.

However, when the value is set from Blueprint, there is no way for the user to call the OnRep function. One would expect that the OnRep would automatically be called on both authority and clients in this case.

Is this behavior by design?

Example code:

UPROPERTY(EditAnywhere, ReplicatedUsing = OnRep_Foo, BlueprintReadWrite)
bool bFoo;

UFUNCTION()
void OnRep_Foo(); 

In this example OnRep_Foo is only called on clients when bFoo is set from Blueprint on authority. There is no way to call OnRep_Foo on authority.

Blueprint will have the authority call the OnRep while C++ won’t.

You will either need to directly call the OnRep_ function from the authority side or call the same code the OnRep_ does.

From my understanding, this is by design.

Hi. Thanks for replying but I feel like you’re not answering the question. I’m describing a case where setting the value in Blueprint is NOT calling OnRep on the authority.