AActor::PreNetReceive
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualENGINE_APIoverride
Description
Called immediately before replicated properties are applied to this actor on the client. Override to snapshot state before the property update so you can compute deltas in PostNetReceive.
Caveats & Gotchas
- • This is called on the client only, never on the server. Authoritative code placed here will silently never run.
- • PreNetReceive/PostNetReceive are called even for incremental property updates, not just initial spawn. Do not assume the actor has just been created when this fires.
- • Always call Super::PreNetReceive() — the engine uses it to snapshot movement-related properties used by the smoothing system.
Signature
ENGINE_API virtual void PreNetReceive() override; Return Type
void Example
Snapshotting location before a property batch arrives C++
void AMyActor::PreNetReceive()
{
Super::PreNetReceive();
// Save the pre-update position so PostNetReceive can compute delta movement
LastReplicatedLocation = GetActorLocation();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?