Search Unity

Pause and resume timeline

Discussion in 'Timeline' started by wabugi, Jun 7, 2017.

  1. wabugi

    wabugi

    Joined:
    Nov 4, 2014
    Posts:
    17
    I am currently trying to create some kind of pause event on a timeline.

    I wrote a custom BasicPlayableBehaviour which can be placed on a timeline like any other clip. It has a reference to the PlayableDirector managing the current timeline. The script pauses the PlayableDirector as soon as the clip is being reached. I used OnBehaviourPlay for this. At this point my script works as intended.

    But of course I want to be able to resume the PlayableDirector later. As soon as I do this, the PlayableDirector continues and of course OnBehaviourPlay is being called again causing my custom clip to pause the Director again.

    Is there some kind of using events or triggers instead of clips on a timeline? Or is there some kind of public function that I missed? I'm thinking of "OnBehaviourStart" or similar.
     
  2. wabugi

    wabugi

    Joined:
    Nov 4, 2014
    Posts:
    17
    I found a workaround for now. I just set the clip duration to 1 frame. I don't know if this is the intended way to use it, but it works :)
     
  3. wabugi

    wabugi

    Joined:
    Nov 4, 2014
    Posts:
    17
    Well, my 1-frame-solution just works sometimes but not always. Still looking for a proper solution!
     
  4. thierry_unity

    thierry_unity

    Joined:
    Jun 10, 2015
    Posts:
    187
  5. wabugi

    wabugi

    Joined:
    Nov 4, 2014
    Posts:
    17
    Fantastic idea, thank you!

    I created two master timelines each controlling the same slave, but with different parameters. The first master plays the first half of the slave and then stops. Master 2 just waits for input and then plays the second half of the same slave. Works like a charm!
     
    Chambers88 and julienb like this.
  6. Chambers88

    Chambers88

    Joined:
    Feb 25, 2018
    Posts:
    6
    I'm having the same problem. My game has dialogue boxes inside cutscenes, and I want the timeline to pause and wait for the dialogue sequence to end (which requires player input) before it resumes. There are several spots in a single timeline where I'd like it to pause and wait for player input.

    @wabugi, how exactly does your first master timeline know when to stop? Did you have to input the desired duration manually, matching the slave timeline, or did you find a solution that somehow marks the spot on the slave timeline? (such as the solution in your first post, where you used a custom track to edit easily in what spots you want it to pause)