Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Custom PlayableDirector, trying to recreate loop functionality

Discussion in 'Timeline' started by ribbanya, Feb 25, 2022.

  1. ribbanya

    ribbanya

    Joined:
    Feb 28, 2019
    Posts:
    9
    Hi, for reasons that are very specific to our project we are using a custom implementation of the PlayableDirector, similar to what's being done in this thread. I have successfully created playables at runtime from timeline tracks, bound them to animators, and played through the timeline once.

    However, when attempting to loop the timeline, the animation (and presumably the entire timeline) will not reset back to time=0 after it has completed once. Once the TimelinePlayable is finished, setting its time does not seem to reset it. I have also tried graph.Stop() and then root.SetTime(0), then graph.Play() again. I have also called SetPropagateSetTime(true) on the root playable (the ScriptPlayable<TimelinePlayable>) upon creation.

    Does the Unity PlayableDirector reinstantiate a playable from a timeline (i.e., the native equivalent of TimelinePlayable.Create) every time it loops or goes backwards in time? I was hoping to avoid doing that.

    I can post some of my code if need be.