public static void SkipToNextMarker(this PlayableDirector timeline) { LabelMarker marker = default; foreach (var m in timeline.SortedMarkers()) { marker = m; Debug.Log($"{timeline} checking {m.Label}"); if (timeline.time < m.time) { Debug.Log($"{timeline} next marker is {m.Label}"); break; } } if (marker) { Debug.Log($"{timeline} skip to {marker.Label}"); timeline.Seek(marker); timeline.Pause(); } }
public static Dictionary <string, LabelMarker> LabelMarkerTimes(this PlayableDirector timeline) { IEnumerable <LabelMarker> markers = timeline.SortedMarkers(); return(markers.ToDictionary(m => m.Label, m => m)); }