ReplicatedUsing (RepNotify) error

Hi! I am trying to implement a RepNotify in C++ like this:

	UPROPERTY(BlueprintReadWrite, ReplicatedUsing = OnRep_myJumpOkEnabled)
	bool myJumpOkEnabled = false;

	void OnRep_myJumpOkEnabled() { GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, FString::Printf(TEXT("TEST"))); }

But when I compile I get this error:

  unresolved external symbol "public: virtual void __cdecl APlayerController_CPP::GetLifetimeReplicatedProps(class TArray<class FLifetimeProperty,class TSizedDefaultAllocator<32> > &)const " (?GetLifetimeReplicatedProps@APlayerController_CPP@@UEBAXAEAV?$TArray@VFLifetimeProperty@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)

Any help?



The OnRep method implementation needs an “_Implementation” at the end and every replicated variable has to be defined in the GetLifetimeReplicatedProps method.

see documentation

1 Like


I am not working in a network game. Its just local. Just want to trigger a function when a variable changes in the same actor.

is all that complicated setup needed anyway? if so I will try to change my current repnotify in the blueprint version by just something simpler logic like checking the change with some timer and a couple variables and then if change happens just call my function.

Ah ok. Than you shouldn’t use replicated variables.
Replicated variables are not for this kind of stuff and absolute overhead and have many things you have to consider.

Instead normally this is done with so called Get-/Set-Methods.
Make the variable non public, so that it can not be get or set from outside. Instead create a function which sets the values and which also does want you want, like throwing an event or something like this.

Don’t use timers for such things! This is not really a good idea and you will have delays and inconsistencies.

1 Like

Add #include “Net/UnrealNetwork.h” to your cpp.
OnRep function doesn’t need a _Implementation I think that was something required in the past but not anymore.

Try moving the definition to the C++ file instead.

and finally make sure you have the GetLifeTimeReplicatedProps implemented like so, do something like my bAI_IsDead
Replace AAIBaseCharacter with your class name.

1 Like


1 Like