Search Unity

Workflow for cutscenes with pauses

Discussion in 'Timeline' started by Baste, Jan 31, 2018.

  1. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,336
    Hi, forums!

    I've been looking into Timeline for a while, and I think I'm getting how it works and what it can do. One thing I haven't seen any info on is how best to do pauses in the middle of cutscenes while waiting for player input - think how a cutscene works in JRPGs (Final Fantasy) or action adventures and whatnot.

    What I'm thinking of here specifically is conversation cutscenes. A timeline is responsible for handling showing the text on the screen, moving the camera, playing animations, etc. But, we want to pause the cutscene until the player's finished reading and presses the "next" button. While waiting for the player, all the characters in the cutscene should have idle animations that loop, as well as small fidgets and whatnot.

    What's the best way to structure this? I could do it though a lot of custom, hacky PlayableBehaviours, but I'm hoping for some good ideas.
     
    GameWorldK and dadude123 like this.
  2. TimmyTheTerrible

    TimmyTheTerrible

    Joined:
    Feb 18, 2017
    Posts:
    186
    I think the easiest solution would be multiple timelines for a conversation. Every time you would want to pause a conversation and wait for input would be the end of a timeline. You don't know which dialogue option the player will choose, and each option would probably play a different timeline based on the player choice anyway. As for the idles inbetween, those could also be separate timelines, or just animator idles if you don't need them to do anything to special.
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,336
    I'm not actually dealing with player choice. It's more of a thing where I'm showing dialogue as text and want to give the player time to read it all at their own pace, or go pee, or just skip over everything entirely.

    I have thought about the multiple-timeline option, problem is that it'll be kinda hard to keep an overview of the cutscene flow. Timing stuff over different timelines also seems like a pain.


    It seems like it's viable to do this kind of thing as a single cutscene, by pausing the timeline, and doing some trickery to get the animations to blend properly between pause and unpause. I'm not yet sure if it's the best approach, though.
     
  4. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    I have the same problem. Timeline feels like it is still missing one or two major big features, but I don't know what they are.

    What I'm doing right now is having multiple timelines. One that contains the start and end movement (paused at 50% until the dialog ends), and then a few more timelines that serve as segments to be played depending on the players choice.


    Its really not optimal and requires a few hacks, I hope someone can come up with a better idea.
     
  5. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    762
    Change the timeline speed to 0 when you reach the point you want to wait for input, then back to 1 when whatever condition is met.

    playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(0);
     
    GameWorldK likes this.
  6. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,336
    Thanks for that!

    I'm curious - how does a speed of 0 differ from Pause()? Does the clips still get their update calls? In that case it would be perfect.
     
  7. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    762
    Yeah, Pause() doesn't do what the name suggests. It stops the timeline running, leaves the header in place and stops evaluating.

    Changing the speed to 0 does what you would expect Pause() to do.
     
    GameWorldK likes this.
  8. bumb4i0pa

    bumb4i0pa

    Joined:
    Jan 29, 2014
    Posts:
    1
    playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(0);
    It doesn't work for me. It pauses everything, including the animations. Is there anything else that i have to take in consideration?
     
    PhaetonLT likes this.
  9. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    762
    That sounds like it's working exactly as intended. If you don't want animations to be paused when this timeline pauses, then they need to be on a seperate timeline or not controlled by a timeline.
     
  10. PhaetonLT

    PhaetonLT

    Joined:
    Nov 23, 2017
    Posts:
    5
    My issue is the same as bump40pa, during dialogue, the animation just stops on setspeed(0) function. I want the character model to still 'live' - perform idle animation pingpong while the user is reading the dialogue text.
    if character animation is on another timeline it just goes on it's own, and if the user would just go to get some coffee before making a choice a character would still go animating (leaving a room for example) as if the dialogue has ended, even though the text is still on.
    I found that if the model has a root animation it still keeps playing, but root animation is limited to one choice only. And if the character model is in let's say 'terminator comes from future' pose it would be strange that on dialogue choice the animation would flip back to 'standing idle'.

    I guess this issue is mostly a problem for the dialogues which need user input, so maybe there aren't so many users that find this an issue...
     
    hmoraes and Immu like this.
  11. dchakrabarty

    dchakrabarty

    Joined:
    Mar 1, 2019
    Posts:
    4
    I use marker and signal events for the purpose. I use two signals called "mark" and "rewind". As play head passes over mark I set up a signal receiver to record the time. Then as it reaches rewind I loop back to this recorded time by setting the time property of the playable. This happens every time unless a key is hit to raise an event to set a flag that causes the rewind activity to be bypassed and playback is progressed.
     
  12. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,336
    Doesn't that mean that you have to manually set the mark and rewind signals to exact loop frames, to not get discontinuities?
     
  13. paulindrome

    paulindrome

    Joined:
    Mar 10, 2018
    Posts:
    36
    Sorry for necroing this thread but this is the first result in google for "unity timeline keep playing idle animation while waiting for input".

    @Baste were you ever able to figure out an elegant solution for this?
     
  14. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,336
    Not that I implemented. The solution is probably to create your own playables that support preview and then do the correct thing at both runtime and edit time, whatever that is for you.

    The question then is if that's less of a hassle than just reimplementing everything from scratch. It probably is, but ymmv.