RealDocs

AActor::PostNetReceive

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: virtualENGINE_APIoverride

Description

Called immediately after replicated properties have been applied to this actor on the client. Override to react to the property batch as a whole rather than using per-property RepNotify functions.

Caveats & Gotchas

  • Fires on clients only. Server-side code here will silently not run.
  • PostNetReceive is called every replication tick where any property changed, so keep it cheap. Heavy logic that does not need to run every update should be gated on specific property changes instead.
  • RepNotify functions (OnRep_*) fire before PostNetReceive. If you need to react after all RepNotify callbacks for the frame have completed, PostNetReceive is the right place.

Signature

ENGINE_API virtual void PostNetReceive() override;

Return Type

void

Example

Reacting to a batch of replicated property changes C++
void AMyActor::PostNetReceive()
{
	Super::PostNetReceive();
	// Location and rotation may both have changed — refresh the cached transform
	CachedTransform = GetActorTransform();
	OnTransformReplicated.Broadcast(CachedTransform);
}

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.