RealDocs

AActor::RewindForReplay

function Engine Since 4.13
#include "GameFramework/Actor.h"
Access: public Specifiers: virtual

Description

Called on the actor before replay checkpoint data is applied, giving it a chance to reset any transient state that checkpoint data does not cover.

Caveats & Gotchas

  • This function is only called when the actor's bReplayRewindable property is true. Without that flag set, the engine destroys and re-creates the actor at each checkpoint instead of calling this function.
  • Unreal's replay system only stores properties marked Replicated or SaveGame; any C++ state that lives outside those properties must be manually reset here, otherwise you will see visual or logical artefacts when scrubbing backwards.

Signature

ENGINE_API virtual void RewindForReplay();

Return Type

void

Example

Reset transient simulation state before replay checkpoint is applied C++
void AMyProjectile::RewindForReplay()
{
    Super::RewindForReplay();
    // Clear accumulated impulse not covered by replicated properties
    PendingImpulse = FVector::ZeroVector;
    bHasHitSomething = false;
}

Version History

Introduced in: 4.13

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.