ACharacter::OnRep_ReplicatedBasedMovement
#include "GameFramework/Character.h"
Access: public
Specifiers: UFUNCTIONvirtual
Description
RepNotify called on simulated proxies when ReplicatedBasedMovement is received from the server. Handles attaching the character to its new movement base and triggering the appropriate movement updates.
Caveats & Gotchas
- • Only called on simulated proxies — the server and autonomous proxy receive base changes through other code paths. Avoid adding gameplay logic here that assumes server authority.
- • The character may briefly appear at an incorrect location between the rep-notify firing and the next movement tick while interpolation catches up. Smooth this with network smoothing settings on CharacterMovementComponent.
- • Calling SetBase directly on a simulated proxy will not replicate back to the server; base attachment is always server-authoritative.
Signature
ENGINE_API virtual void OnRep_ReplicatedBasedMovement() Return Type
void Example
Override to react to base changes on simulated proxies C++
void AMyCharacter::OnRep_ReplicatedBasedMovement()
{
Super::OnRep_ReplicatedBasedMovement();
// React to the new base, e.g. play a land effect
if (GetReplicatedBasedMovement().MovementBase != nullptr)
{
PlayLandEffect();
}
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?