đTimeflow Controller
A script to control Timeflow playback at runtime
This component may be used to start and stop playback, queue specific markers, or play custom regions in time. Use the Timeflow Controller for cutscenes or to play animations interactively.
To add a new Timeflow Controller, first select the Timeflow instance in the scene that you wish to control, and then select from the main menu:
Tools/Timeflow/Add/Timeflow Controller

Timeflow
Designates the Timeflow instance being controlled. Any other Timeflow instances in the scene will not be affected by this controller, unless they are children of the target Timeflow.
Work Area Enabled
This determines whether the Work Area is used in Timeflow to constrain playback to a specific region in time. In most cases, the Work Area is desired to set the start and end time for the current marker being played, though it may be turned off to continue to play the timeline until the end, or until interrupted by another event.
Play Mode
This sets the default play mode when the Play() method is called.
Skip Duration
This specifies the duration in seconds to lead out of the current work area region when Skip() is invoked. If for example the current work area ends at 10 seconds and the skip duration is set to 2, invoking Skip() will fast forward to 8 seconds and play through to the end at 10.
Start At Marker Index
Queues Timeflow to play on scene start at the designated marker by index value. Each marker in Timeflow has a unique index (integer value). Typically, 1 is the first index in the scene unless it has been changed.
Note that index values may change if the Re-Index command is used in the Timeflow Markers inspector.
Start Play Mode
Sets the play mode initially upon scene start.
Play Modes
Determines how playback behaves, with one of the following settings.
None
Timeflow does not play and remains paused. Use this mode to stop Timeflow completely.
One Shot
Plays through the designated time region once. When it reaches the end of the current area, playback stops.
Looped
Plays the current work area (or full timeline) repeating indefinitely.
Continuous
This mode continues to play even when the end of the work area is reached. However, playback will stop when it reaches the end of the timeline.
Unity Events
The following events can be configured in the editor to perform additional actions. These can be used to setup game logic in the editor without additional scripting. For more information, see the Unity Events documentation.
On Startup
This event is called once when the Timeflow Controller initially starts. This event is invoked during Start(), after the above startup play mode has been executed.
On Play
This event is invoked each time any Play method is called on the Timeflow Controller.
On Stop
This event is invoked once playback stops or reaches the end of the current time section.
On Skip
This event is invoke when Skip() is called, either by script or by an event.
Methods
The following methods are defined in the Timeflow Controller script and may be called wither by script or events.
SetWorkAreaStart(float startTime)
Explicitly set the start time of the playback region.
SetWorkAreaEnd(float endTime)
Sets the end time of the current playback region.
SetWorkArea(float startTime, float endTime)
Sets the start and end time of the current playback region in one call.
PlayFromMarkerIndex(int index)
Queue playback starting from the marker with the given index, automatically setting the time region up to the following marker.
PlayFromMarker(string markerName)
Queues playback of a marker region with a specific name, automatically setting the time range up to the next marker after it.
Be careful to enter marker names precisely. They are case sensitive. If no marker is found matching the specified name, nothing will happen.
PlayFromMarker(TimeflowMarker marker)
Queues playback using a marker reference. This is called internally or by other scripts with a TimeflowMarker object.
PlayFromTime(float time)
Starts playback from a specific time in seconds.
PlayFromStart()
Starts playback from the beginning of the current work area, or the start of the timeline if the work area is off.
Play()
Resumes playing from the current time.
Skip()
Advances time to the end of the current work area. If the Skip Duration is set, the time is advanced to that duration before the end, to allow lead out time.
Stop()
Stops playback. This is also the same as pausing Timeflow. If Play() is called afterward, it resumes from the current tiem.
SetPlayModeOneShot()
Sets the current play mode to One Shot.
SetPlayModeContinuous()
Sets the current play mode to Continuous.
SetPlayModeLooped()
Sets the current play mdoe to Looped.
Last updated