Pause and resume timeline

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.

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 :slight_smile:

Well, my 1-frame-solution just works sometimes but not always. Still looking for a proper solution!

maybe the solution given by JulienB would work for you too?
see: "Pausing" Timeline Playback - Unity Engine - Unity Discussions

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!

2 Likes

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)