Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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.