⏰Event

Trigger a function or event at a specific time during playback

Events provide a way to invoke function calls during playback to implement custom behaviors. This is primarily used to initiate or end a state related to game play or other interactive applications.

Events only execute during playback

An event is only triggered when Timeflow is playing continuously. This does not require entering Play Mode in Unity, unless the function being invoked is a runtime-only feature.

Add an Event by right-clicking on the object in the Timeflow view and selecting: Add Automation > Events > Timeflow Event Alternatively:

Select a track section in the Track View and right-click to select Events.

Note that Events do not have any channels and instead appear like a keyframe on the track channel, as shown above.

Events have similar editing features to keyframes and are included with Related Keyframe operations.

Editing Events in the Info Panel

Click on an event in the Track View to view its settings in the Info Panel. Please see the editor section below for more options and further explanation of each setting.

Multiple events may be selected at once for bulk editing in the Info Panel.

Goto

Click the Goto button in the Info Panel or double-click on the event in the Track View to jump to the time of the event.

Event Editor

Select the game object to view Event settings in the Inspector. Events, like all other behaviors, are applied as components, with no limit on the number of events applied to each object.

Events do not allow Update Settings to be customized, otherwise it may not perform as expected or events may not trigger at all.

Please refer to Menu Bar for common features.

Event Name

Enter a name to help manage and identify events. This is for organizational purposes and is not required nor does it affect functionality.

Triggered

Indicates when the event has been fired (checked) or not (unchecked). This gets reset upon start and when rewinding the timeline in edit mode.

Setting the Triggered checkbox manually overrides the internal tracking of whether or not the event has been fired. This may be useful while testing to allow or prevent an event from firing.

Trigger Now

Use this to invoke the event function immediately bypassing any restriction on limit. This is used only for testing events.

Trigger Time

Sets the time the event is to be triggered during playback.

Trigger Time is in local time which may be affected by Time Offset.

Set to Current Time

Assigns the event time using the current time of the playhead.

Lock

Enable lock to prevent the event time from being changed. This also prevents dragging events in the Track View.

Trigger Limit

Events may be limited to perform only a certain number of times during each run. This value may be left at 0 for the event to be fired without limit.

Under normal circumstances, Timeflow plays through just once and the limit is not needed. However, when looping sections of time or rewinding to replay from the beginning, this may be needed to ensure certain actions aren't repeated.

Trigger Limit is primarily used for interactive applications. For example, it could be used to display instructions to a user only the first time playing through a scene, but skipped on replays (during the same session). Or it could be used with other interactive contexts that limits the number of times a user is allowed to repeat actions.

Trigger Limit is enforced at runtime only When playing back Timeflow in edit mode, event triggers are reset each time rewinding the scene so that they fire each time played. This is much better for creative workflow while editing. However, during runtime (Play Mode) triggers are only initialized at start and never reset when rewinding or looping so that the Trigger Limit may be enforced.

Send Message To

Uses GameObject.SendMessage to invoke the named method and optional parameter. This works in edit mode if the target method does.

Note that the named function is invoked for every component on the Target object that implements it. If no component with the function is found, then it fails silently.

Function and Parameter

Enter the exact name of the class method and leave blank or enter a parameter value to pass to the function when invoked. Below are examples showing how to implement methods in a component script.

public void MyMethod()
{
    Debug.Log("MyMethod");
}

public void MyMethod(string value)
{
    Debug.Log("MyMethod:" + value);
}

OnTrigger()

Use Unity Events to trigger any object or property value.

Trigger State Reset

Note that there is no automatic mechanism to reset or undo actions performed by events, unless you add them in some manner. As in the example above, the Spaceship object is deactivated by the event, so would require another event or other mechanism to reactivate it. Otherwise, it will remain inactive. Whenever creating events that make unidirectional changes, it is recommended to have an initialization process or add another event that resets objects to their default states at the appropriate times.

Event Timing and Latency

During playback, the precise time of an Event may not exactly align to the current time due to frame rates and timing intervals. To determine when an event is triggered, Timeflow checks whether the event time falls within the last update time and the current time (ignoring explicit jumps in time).

In most cases the discrepancy between the set trigger time and the actual time triggered is microseconds. However, in cases where frame rate has dropped or playback is skipping for other reasons, the actual event time triggered may be delayed.

Testing Events

You may also press Trigger Now at any point to fire an event, regardless of any limits set.

Event Scripting

The behavior is officially named TimeflowEvent so as to avoid ambiguity with other event types in Unity. Custom event implementations may also be created using TimeflowEvent as a base class. See TimeflowEvent.cs and Scripting for more information.

Last updated