Timeline Mixer Documentation
Loading...
Searching...
No Matches
Runtime Events

Events can be added to Timelines at runtime through the SetTimelineEvent method:

cs
TimelineMixerComponent timelineMixer = GetComponent<TimelineMixerComponent>()
float eventTime = 2f; //2 seconds
timelineMixer.SetTimelineEvent(timelineAsset, eventTime, () => { timelineMixer.FadeOut(timelineAsset, 2f); Debug.Log($"{timelineAsset.name} Event Fired!"); });
//OR
Action callback;
callback = () => { timelineMixer.FadeOut(timelineAsset, 2f); Debug.Log($"{timelineAsset.name} Event Fired!"); };
timelineMixer.SetTimelineEvent(timelineAsset, eventTime, callback);

This sets an event on the timeline at the 2 second mark, which will launch the callback passed in when creating the event.

It is not possible to remove individual events at this time, events can be cleared however:

cs
timelineMixer.ClearTimelineEvents(timelineAsset);