Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

How to edit PlayableDirector variables via script

Discussion in 'Timeline' started by Carwashh, Aug 31, 2017.

  1. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    479
    I have a looping timeline, which I want to check if something has occurred before it loops. As there are no events (yet), I'm using a custom playable.

    The custom playable gets a reference to the class which keeps track of the state, when the clip is entered into the state is checked ->
    If state is ok then stop this timeline and play bound timeline.

    I would like to stop the current timeline via either Stop() or changing the WrapMode to not loop.

    How? I can't find how to access either the timeline the track is played on from the clip, or wrap mode on the playable director.
     
  2. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    479
    Achieved what I was after by doing
    Code (csharp):
    1. PlayableGraph thisGraph = playable.GetGraph();
    and then
    Code (csharp):
    1. thisGraph.Stop();
    where required.
     
unityunity