Unity Timeline
Unity Timeline Integration
Time Crystal's Time Machine module exposes dedicated Unity Timeline tracks so designers can sequence recorded gameplay just like animation clips. This page breaks down the prerequisites, class relationships, and recommended workflows for both global and per-object playback.
Requirements
Time Machine Timeline scripts are conditionally compiled. Make sure the following are present before expecting the tracks to appear in the editor:
Recorded data – Objects must already be tracked by
GameObjectTimeMachine. Global clips pull targets withGetAllRecordedObjects, while local clips queryGetTimelineForObject/GetSnapshotAtTime. Without recorded snapshots the playables will log warnings and do nothing.
Why use Timeline with Time Machine?
Cinematic control over recorded gameplay – Drop clips on a track to choreograph rewinds, slow motion, or branch jumps synchronized with your cutscene.
Editor-friendly iteration – Artists can adjust playback speed, interpolation, and blending directly in Timeline without touching scripts.
Consistent branching – Switch entire scenes or individual actors to alternative branches on cue, enabling "what if" storytelling and interactive flashbacks.
Layered composition – Combine global and local tracks to mix sweeping scene-wide effects with hero-character refinements.
Global playback workflow
Use the global track when you want a single clip to drive every recorded object in the scene.
GlobalTimeMachineTrack
GlobalTimeMachineTrackThe track itself is a TrackAsset that advertises GlobalTimeMachineClip instances and exposes a simple debug toggle. It defaults new clips to a five second duration and renders purple in Timeline so you can distinguish it from per-object tracks.
GlobalTimeMachineClip
GlobalTimeMachineClipA clip defines the parameters pushed to all playback behaviours:
Branch selection, direction, speed, start offset, interpolation, and tag-based filtering.
Its
CreatePlayablemethod instantiates aScriptPlayable<GlobalTimeMachinePlayableBehaviour>and copies the serialized fields into the behaviour instance.
GlobalTimeMachinePlayableBehaviour
GlobalTimeMachinePlayableBehaviourWhen the clip plays it materializes one LocalTimeMachinePlayableBehaviour per recorded object and synchronizes each frame:
Initialization gathers the target list from the branch via
GameObjectTimeMachine.GetAllRecordedObjects, logging warnings if the branch is empty.During play/prepare/process it forwards settings (direction, speed, interpolation) and respects tag filters before delegating to each local behaviour.
A
RefreshTargetObjectshelper lets you force re-initialization if you spawn new recordable objects mid-sequence.
GlobalTimeMachineMixerBehaviour
GlobalTimeMachineMixerBehaviourGlobal tracks do not need complex blending. The mixer simply forwards playable weights and can optionally log which clip is active for debugging.
Local playback workflow
Local tracks excel when you need granular control per actor (e.g., rewinding a single character while the rest continue forward).
LocalTimeMachineTrack
LocalTimeMachineTrackThis TrackAsset binds to a GameObject and registers transform properties so Timeline knows they will be animated, ensuring proper editor previews.
LocalTimeMachineClip
LocalTimeMachineClipSerialized clip fields cover branch selection (string and legacy enum), direction, speed, offsets, interpolation, and whether to blend with the live state when clip weight is below one. CreatePlayable builds a LocalTimeMachinePlayableBehaviour and injects these values along with the bound GameObject reference.
LocalTimeMachinePlayableBehaviour
LocalTimeMachinePlayableBehaviourThe local behaviour is responsible for:
Resolving the correct branch/timeline for its bound object, falling back to
Originaland issuing warnings if the requested branch is missing.Calculating the effective timeline time using clip speed, direction, and offsets, including reverse playback support.
Capturing live transform state for blends and exposing the latest snapshot to the mixer.
Synchronizing subsystems—AudioSource, ParticleSystem, Rigidbody, NavMeshAgent, Animator—so reverse playback and slow motion feel cohesive (see extended methods further down the file).
LocalTimeMachineMixerBehaviour
LocalTimeMachineMixerBehaviourThe mixer reads each input's CurrentSnapshot (or live state for blending clips), accumulates weighted transforms, and writes the blended result back to the bound GameObject each frame.
Combining global and local tracks
The global system excels at broad strokes—scene-wide rewinds, synchronized branch swaps, or massive slow-motion beats. Local tracks let you nuance hero characters or UI elements with bespoke pacing, or keep certain actors grounded in the present while everything else reverses. Layer clips across both tracks to orchestrate complex time manipulation sequences without hand-authored scripts.
Last updated