RealDocs

ACharacter::PreNetReceive

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

Description

Called on the client immediately before applying an incoming network update for this Character. ACharacter uses this to snapshot the replicated gravity direction so post-receive logic can detect changes.

Caveats & Gotchas

  • Only executes on clients (simulated and autonomous proxies) — never called on the authoritative server.
  • Do not apply gameplay logic here that assumes the new values are already committed; the replicated properties have not been written yet when PreNetReceive fires.

Signature

ENGINE_API virtual void PreNetReceive() override;

Return Type

void

Example

Snapshot a replicated value before replication overwrites it C++
void AMyCharacter::PreNetReceive()
{
    Super::PreNetReceive();
    // Cache old value so PostNetReceive can diff against the incoming one
    OldReplicatedState = CurrentReplicatedState;
}

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.