ACharacter::GetLifetimeReplicatedProps
#include "GameFramework/Character.h"
Access: public
Specifiers: virtualoverrideconst
Description
Registers which properties are replicated to remote machines and under what conditions. ACharacter uses this to replicate movement state, crouch, jump force, and other core character properties.
Caveats & Gotchas
- • Always call Super::GetLifetimeReplicatedProps(OutLifetimeProps) — skipping it disables replication of all base-class properties including BasedMovement and bIsCrouched.
- • Use DOREPLIFETIME_CONDITION to register properties with conditions (e.g. COND_SimulatedOnly) so you don't replicate data to owning clients that compute it locally.
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
Register a custom replicated property C++
void AMyCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AMyCharacter, Health);
DOREPLIFETIME_CONDITION(AMyCharacter, AmmoCount, COND_OwnerOnly);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?