AActor::PreReplication
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtual
Description
Called on the server (and autonomous proxy during client replays) immediately before replication occurs. Override to set DOREPLIFETIME_ACTIVE_OVERRIDE conditions or batch-prepare replicated data.
Caveats & Gotchas
- • Only called at all when bCallPreReplication is true for this actor (default false for perf reasons). Enable it via SetCallPreReplication(true) if you override this function.
- • Not called on simulated proxies or listen-server clients unless recording a replay — use OnRep callbacks on clients instead.
- • Avoid expensive calculations here; this runs every potential replication tick, which can be very frequent for fast-paced actors.
Signature
ENGINE_API virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| ChangedPropertyTracker | IRepChangedPropertyTracker & | Tracker that records which conditional properties should be replicated this frame. | — |
Return Type
void Example
Conditionally replicate a property based on game state C++
void AMyActor::PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker)
{
Super::PreReplication(ChangedPropertyTracker);
DOREPLIFETIME_ACTIVE_OVERRIDE(AMyActor, SecretValue, bShouldReplicateSecret);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?