Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Tips and tricks for using PlayableDirector in Manual update mode

Discussion in 'Timeline' started by doctorpangloss, Aug 4, 2019.

  1. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    183
    The documentation on this is pretty sparse and infuriating so I'm including the completely undocumented things you need to do to actually control a PlayableDirector manually.

    The main thing you're probably missing is that you always call
    Code (CSharp):
    1. playableDirector.DeferredEvaluate()
    once per frame.

    • Set your Update Mode to Manual.
    • In an Update function, call
      Code (CSharp):
      1. playableDirector.DeferredEvaluate();
    • If you want to advance the whole director, use
      Code (CSharp):
      1. playableDirector.time += yourDeltaTime
      .
    • If you want to use the PlayableGraph object, for whatever reason, you must rebuild the graph at least once (try doing it in Start / Awake) or whenever your playable asset changes:
      Code (CSharp):
      1. playableDirector.RebuildGraph();
      2. playableDirector.playableGraph.SetTimeUpdateMode(DirectorUpdateMode.Manual);
     
    seant_unity likes this.