Unity Timeline pause and resume

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
TobyM
Posts: 14
Joined: Wed Dec 26, 2018 5:03 pm

Unity Timeline pause and resume

Post by TobyM »

Hello!

I've got a question concerning the dialog system and Unity timeline. I'm trying to create a cutscene, using a single timeline payable, that should be started, paused and resumed during the conversation. The conversation starts beforehand and then uses the Timeline() command to play the timeline. I'm also using the Play Sequence Track and the Continue Conversation Track. But there seems to be a problem with the latter one. If I try to continue the conversation with a clip, the entire timeline seems to be stopped completely. This also happens when I use the Continue() command in a Play Sequence Clip.
I also tried to pause the timeline by using a Play Sequence clip and the Timeline(pause, Timeline) command, which at first seems to work, but a couple of seconds later, the timeline resets back to the start.
This problem only occurs when I start the timeline with the TImeline()command. If I set "Play On Awake" to true in the Playable Director, then I can use continue clips and pause the timeline without a problem. But as soon I use the Timeline() command (even if the timeline is played on awake), the same problems as before return.
Thank you in advance for your help!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Timeline pause and resume

Post by Tony Li »

Please download and import the updated Timeline Support package from the Dialogue System Extras page.

This adds another mode 'speed' to the Timeline() sequencer command.

Instead of using Timeline(pause,YourTimeline), to pause use:

Code: Select all

Timeline(speed,YourTimeline,0)
and to resume use:

Code: Select all

Timeline(speed,YourTimeline,1)
TobyM
Posts: 14
Joined: Wed Dec 26, 2018 5:03 pm

Re: Unity Timeline pause and resume

Post by TobyM »

Thank you, using this version of the Timeline() seems to solve some of the problems!
Unfortunately it still only works if the Timeline was started on Awake, otherwise, the Continue Conversation Clips still stops the Timeline. So my current approach is to set "Play on Awake" to true and set the speed to 0 with a Play Sequence Clip right at the beginning of the Timeline.
Also, for some reason, it tends to skip to the next node, as soon as I use the Timeline(speed, Timeline, 1) command, although the continue mode is set to false. Was able to mitigate this problem by using the Delay() command, but I'm still not sure why this happens.
So yeah, not quite optimal, but it's now on a level where I can create functional cutscenes, so again thank you very much for your help!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Timeline pause and resume

Post by Tony Li »

Hi,

Try adding 'nowait' and 'nostop' to the play and resume commands, such as:

Code: Select all

Timeline(play,YourTimeline,nowait,nostop)
This tells the commands that you'll be controlling when it stops and starts.
TobyM
Posts: 14
Joined: Wed Dec 26, 2018 5:03 pm

Re: Unity Timeline pause and resume

Post by TobyM »

Ahh, I tried all kind of methods to fix this issue, but for some reason, I never even attempted to use those parameters to the Timeline command. Using both seem to still cause some problem, but if I only use the "nostop" keyword it workes as intended. Really should have tried those before asking here ... anyway, again thanks a lot for your help!

Got one last question: I was planning to use a Play Sequence Clip with a Timeline(pause, Timeline) command, but the clip gets executed a second time after the timeline resumes (Which results in the timeline being paused immediately). I tried to shrink the clip down to the smallest possible size, but this solution only seems to function about 50% of the time. It's not a big deal though, I just moved the timeline command to a node within the conversation, that workes just fine. Just thought I ask if you know a way to prevent this? Or is this just a quirk from the Unity timeline itself?

/Edit:
Okay, this problem also occurs with the ContinueConversationClips, just not as frequent. So, unfortunately, my workaround doesn't quite work either.

/Edit2:
Found a solution. Made a new sequence command, which skips the current time of the timeline 0.02 seconds ahead after it is paused.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Timeline pause and resume

Post by Tony Li »

I'll look into this further. If I find a better solution than your custom sequencer command, I'll let you know.
TobyM
Posts: 14
Joined: Wed Dec 26, 2018 5:03 pm

Re: Unity Timeline pause and resume

Post by TobyM »

Alright, thx!
Post Reply