RealDocs

APawn::GetLifetimeReplicatedProps

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

Description

Registers which UPROPERTY members are replicated and how, by appending FLifetimeProperty entries to OutLifetimeProps. APawn uses this to replicate Controller, PlayerState, and RemoteViewPitch.

Caveats & Gotchas

  • Always call Super::GetLifetimeReplicatedProps(OutLifetimeProps) first in overrides — omitting it prevents the base class properties (Controller, PlayerState) from replicating, which breaks possession and HUD.
  • Properties added here must be declared with UPROPERTY(Replicated) or UPROPERTY(ReplicatedUsing=...) in the header; adding a property here without the UPROPERTY macro causes an ensure/crash in debug builds.
  • Condition flags like COND_OwnerOnly or COND_SkipOwner significantly affect bandwidth — pick the most restrictive condition appropriate for each property.

Signature

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

Parameters

Name Type Description Default
OutLifetimeProps TArray<FLifetimeProperty>& Array to append replicated property descriptors to.

Return Type

void

Example

Replicate a custom property in an APawn subclass C++
void AMyPawn::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
	DOREPLIFETIME(AMyPawn, Health);
	DOREPLIFETIME_CONDITION(AMyPawn, AmmoCount, COND_OwnerOnly);
}

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.