Who am I?

Unity / Unreal Developer and 3D Artist

What I write about

Recent Posts

Unity Timelines

Unity's Timeline component is a powerful NLE animation system with a highly modular internal structure.

As such it can be interesting to access parts of it via the API:

// PlayableDirector references to the timeline asset called PlayableAsset
PlayableAsset playableAsset = director.playableAsset;

// Cast it to a proper timeline asset
TimelineAsset timeline = (TimelineAsset)playableAsset;

// Get all the timeline tracks as TrackAsset
IEnumerable<TrackAsset> trackAssets = timeline.GetOutputTracks();

// Iterate through all the tracks
foreach (TrackAsset trackAsset in trackAssets)
    Debug.Log(string.Concat("TrackAsset ", trackAsset.GetType()));

    // Get the individual clips of a track as TimelineClip
    IEnumerable<TimelineClip> clips = trackAsset.GetClips();

    foreach (TimelineClip clip in clips)
        Debug.Log(string.Concat("TimelineClip ", (float)clip.start, "-", (float)clip.end, " ", (float)clip.duration, " ", clip.displayName));

    // New as of Unity 2019.1 are Marker track assets
    IEnumerable<IMarker> markers = trackAsset.GetMarkers();

    // These can be casted into SignalEmitters, which then work similar to events on the timeline
    foreach (IMarker marker in markers)
        SignalEmitter signalEmitter = (SignalEmitter)marker;
        Debug.Log(string.Concat("SignalEmitter ", signalEmitter.time, " ",;