RealDocs

APlayerState::GetLifetimeReplicatedProps

function Engine Since 4.0
#include "GameFramework/PlayerState.h"
Access: public Specifiers: virtualoverride

Description

Registers which properties are replicated and their replication conditions. Override this in subclasses to add DOREPLIFETIME entries for custom replicated properties alongside a Super call.

Caveats & Gotchas

  • Always call Super::GetLifetimeReplicatedProps(OutLifetimeProps) first. Omitting the Super call removes replication of all built-in APlayerState properties (Score, PlayerName, bIsABot, UniqueId, etc.), silently breaking the entire player state network contract.
  • This function is called once when the actor is first registered with the net driver, not every frame. Adding or removing entries dynamically at runtime has no effect — the replication layout is fixed after this call.
  • Use DOREPLIFETIME_CONDITION for conditional replication (e.g. COND_OwnerOnly for private player data such as inventory counts or private stats that only the owning client should see).

Signature

ENGINE_API virtual void GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const override;

Parameters

Name Type Description Default
OutLifetimeProps TArray< FLifetimeProperty > & Array to which this function appends replication descriptors for each replicated property.

Return Type

void

Example

Register a custom replicated kill-count property C++
// MyPlayerState.h
UPROPERTY(Replicated)
int32 KillCount;

// MyPlayerState.cpp
#include "Net/UnrealNetwork.h"

void AMyPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps); // Must call Super
	DOREPLIFETIME(AMyPlayerState, KillCount);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.