Search Unity

PlayableDirector: Stop vs Pause

Discussion in 'Timeline' started by tarahugger, Jul 2, 2018.

  1. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    120
    I noticed that if i call Stop() on a PlayableDirector it seems set the graph to Null, and i assume its been disposed as the output .IsOutputValid() becomes false. Are they supposed to get rebuilt every time Play()/Stop() is cycled?

    In my case i am re-configuring an output with a mixer for blending and so having to rebuild and redo all that work every time stop is called seems like a bad idea. The better option, particularly if they're heavily re-used seems to be to call Pause() and then set the time back to 0 manually before hitting play() again.

    Are there any consequences to either approach we should know about?
     
  2. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    146
    The playable graph generated by timeline is destroyed when Stop() is called; when a timeline finishes playing, we expect it not to leave any traces behind.

    There is no problem in pausing the timeline and resetting its time to 0 if you restart your timeline frequently. This will avoid creating/destroying a playable graph on each cycle.
     
    tarahugger likes this.
unityunity