ACharacter::PreReplication
#include "GameFramework/Character.h"
Access: public
Specifiers: virtualoverrideENGINE_API
Description
Called on the server (and for autonomous proxies during Client Replay recording) immediately before replication to give the actor a chance to update replicated properties or mark which ones have changed.
Caveats & Gotchas
- • Only runs on the server under normal gameplay and on the autonomous proxy only when recording a client replay. Do not put server-only logic here and expect it to run on the client.
- • ACharacter's override packages root motion data into RepRootMotion for replication. If you override PreReplication without calling Super, root motion replication will silently break for all simulated proxies.
Signature
ENGINE_API virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| ChangedPropertyTracker | IRepChangedPropertyTracker& | Tracks which properties have changed this frame and should be included in the next replication update. | — |
Return Type
void Example
Override to conditionally prepare a custom replicated property C++
void AMyCharacter::PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker)
{
Super::PreReplication(ChangedPropertyTracker);
// Update the replicated snapshot of our custom ability state before it goes out
ReplicatedAbilityState = AbilitySystemComponent->GetCurrentAbilityState();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?