Search Unity

How to edit PlayableDirector variables via script

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

  1. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    762
    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:
    762
    Achieved what I was after by doing
    Code (csharp):
    1. PlayableGraph thisGraph = playable.GetGraph();
    and then
    Code (csharp):
    1. thisGraph.Stop();
    where required.