RealDocs

AActor::OnRep_ReplicatedMovement

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

Description

Called on clients when the ReplicatedMovement struct is replicated. The default implementation calls PostNetReceiveLocationAndRotation to apply the new transform.

Caveats & Gotchas

  • Not called for actors simulating physics (bReplicateMovement + physics simulation) — the engine applies physics state directly via PostNetReceivePhysicState.
  • If you override this, call Super::OnRep_ReplicatedMovement() unless you are fully replacing the movement-apply logic, otherwise location/rotation will never update on clients.
  • ReplicatedMovement replication is controlled by bReplicateMovement; if that is false, this callback never fires.

Signature

ENGINE_API virtual void OnRep_ReplicatedMovement()

Return Type

void

Example

React to a replicated movement change C++
void AMyActor::OnRep_ReplicatedMovement()
{
    Super::OnRep_ReplicatedMovement();
    // Snap a trail effect to the new location
    TrailComponent->SetWorldLocation(GetActorLocation());
}

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.