Replicated UPROPERTY in PlayerState prevents game from starting

Hi all, I’m having some trouble getting my PlayerState to work.

I need an uint8 identifier in the PlayerState for internal book keeping. The reason why it’s uint8 is that it gets sent around a lot during multiplayer matches and I want to keep it small. I’m on linux using UE 4.12.5 source build (upgrade planned, but for now I have to live with that version)

I created the following class and set it in my GameMode.

Header:

UCLASS()
class GAME_API AMyPlayerState : public APlayerState
{
	GENERATED_BODY()

private:

    UPROPERTY(Replicated) /* THE PROBLEM IS HERE */
		uint8 Identifier_;

public:
	UFUNCTION(BlueprintCallable, Category = "My Player State")
		void SetIdentifier(uint8 id) { Identifier_ = id; }
	UFUNCTION(BlueprintCallable, Category = "My Player State")
		uint8 GetIdentifier() { return Identifier_; }

    virtual void CopyProperties(APlayerState* PlayerState) override;
	
};

CPP:

void AMyPlayerState::CopyProperties(class APlayerState *PlayerState)
{
    Super::CopyProperties(PlayerState);
    if (PlayerState)
    {
        AMyPlayerState* State = static_cast<AMyPlayerState*>(PlayerState);
        if (State)
        {
            State->Identifier_ = Identifier_;
        }
    }
}

The Problem is that if I add ‘Replicated’ to uint8 Identifier_; the project fails to load and I get the following error in a Popup Dialog:

The game module ‘Game’ could not be loaded. There may be an operating system error or the module may not be properly set up.

In the terminal I get a bit more details, but not enough:

2017.03.13-01.02.00:838][  0]LogLinux:Warning: dlopen failed: <PATH_TO_PROJECT>/Binaries/Linux/libUE4Editor-Game-1198.so: undefined symbol: _ZTV16AMyPlayerState
[2017.03.13-01.02.00:838][  0]LogModuleManager:Warning: ModuleManager: Unable to load module '<PATH_TO_PROJECT>/Binaries/Linux/libUE4Editor-Game-1198.so' because the file couldn't be loaded by the OS.

At the same time the Project compiles fine with Replicated added to the UPROPERTY. If I compile from the terminal no errors are reported. If I compile from the compile button in UE4 the “dlopen failed” terminal error appears in the Output Log.

I searched everywhere but it seems like I cannot solve it myself.
I hope someone can help me with this.

Best regards

twinflyer

[EDIT] Problem solved. I didn’t realize the APlayerState inherits AActor. Once I added the following everything is working. Thanks for everyone who had a look.

void AMyPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    DOREPLIFETIME(AMyPlayerState, Identifier_);
}