/// <summary> /// Jumps to the given label's time and evaluates there /// </summary> public static void Seek(this PlayableDirector timeline, LabelMarker label) { try { timeline.Seek(label.time); } catch (Exception) { throw new ArgumentException("Label not found"); } }
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 bool IsPastMarker(this PlayableDirector timeline, LabelMarker marker) { return(marker.time < timeline.time); }