I’m trying to replicate an actor reference in my game, but whenever I try to make the variable replicated, it won’t compile. Here’s what I have:
UPROPERTY(Replicated)
class AActor* Target;
This is exactly what the docs say to do. But every time I try to compile with “Replicate” in the code, I get a compile error. This is in the message log that appears;
Info Creating makefile for hot reloading MAWN (ini files are newer that UBTMakefile)
Info Compiling game modules for hot reload
Info Performing 1 actions (9 in parallel)
Info [1/1] Link UE4Editor-MAWN-8104.dll
Info Creating library C:\Users\NAME\Documents\Unreal Projects\MAWN\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MAWN-8104.lib and object C:\Users\NAME\Documents\Unreal Projects\MAWN\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MAWN-8104.exp
Error Explosion.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AExplosion::GetLifetimeReplicatedProps(class TArray<class FLifetimeProperty,class FDefaultAllocator> &)const " (?GetLifetimeReplicatedProps@AExplosion@@UEBAXAEAV?$TArray@VFLifetimeProperty@@VFDefaultAllocator@@@@@Z)
Error MAWN.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl AExplosion::GetLifetimeReplicatedProps(class TArray<class FLifetimeProperty,class FDefaultAllocator> &)const " (?GetLifetimeReplicatedProps@AExplosion@@UEBAXAEAV?$TArray@VFLifetimeProperty@@VFDefaultAllocator@@@@@Z)
Error C:\Users\NAME\Documents\Unreal Projects\MAWN\Binaries\Win64\UE4Editor-MAWN-8104.dll : fatal error LNK1120: 1 unresolved externals
Info ERROR: UBT ERROR: Failed to produce item: C:\Users\Name\Documents\Unreal Projects\MAWN\Binaries\Win64\UE4Editor-MAWN-8104.dll
Info Total build time: 4.36 seconds
Everything works fine if it isn’t there. I’m trying to get this variable on an APawn but I’ve tried it on an ACharacter with the exact sime result. I can’t find a fix for this anywhere.