🎞️Timeflow Playback

Playback integration for custom scripts

This is a base class providing a general API for implementing custom playback logic. The API is defined by the interface ITimeflowPlayback, implemented abstractly by TimeflowPlaybackBase and concretely by TimeflowPlayback for convenience.

Timeflow Parent

This assigns the Timeflow instance to observe playback events. If none is specified explicitly, it defaults to the current active Timeflow in the scene.

Callback Methods

The following methods may be overridden to implement custom logic:

  • OnPlay() : Called when playback starts or resumes

  • OnStop() : Called when playback stops or is paused

  • OnUpdate() : Called each frame playback updates - only while playing

  • OnRewind() : Called whenever time jumps backward

  • OnLoop() : Called whenever looping occurs during playback

To get the current time, use TimeflowParent.CurrentTime

Register and Unregister

It is important that each script that implements ITimeflowPlayback registers itself globally, otherwise it will not receive the above event callbacks. And each script should Unregister itself when destroyed or deactivated.

Last updated