Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Pause/Resume game between Timeline Cutscenes

Discussion in 'Timeline' started by shubhank008, Oct 7, 2018.

  1. shubhank008

    shubhank008

    Joined:
    Apr 3, 2014
    Posts:
    107
    I am new to Unity Timeline learning and creating my first cutscene with it. I have understood the part about using Timeline and to create cutscenes with it, but I am confused on how to insert/play that cutscene between a game event and how to handle "pausing" the game during that cutscene.

    Here is my scenario:

    I am creating a game that uses realtime/time based scoring and other mechanics, including physics/movement that change every second for the character. Think of it as a endless runner, where you are always running and score is increasing.

    Now, at a certain event, say 100 score, I want to introduce a cutscene where the character stops, meet with another character and converse. The animation part I am able to do in Timeline. Its just that I am not getting how to play the timeline/cutscene at that event.
    Furthermore, how do I pause/resume the gameplay before and after the cutscene ? Do I manually need to add a check to pause scoring, movement etc. when the cutscene is playing or not ? Furthermore, can I reset the position/transform of the character back to its original in game (before the cutscene) after I have changed it in timeline animation (after the cutscene) ?



    Sorry if some of these questions sound Amateurish. Just overwhelmed and confused, didn't find a lot of (or rather any) videos covering this.
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Good questions, I'll do my best to answer but some of it depends on how you build your game.

    Furthermore, how do I pause/resume the gameplay before and after the cutscene ?

    This one is very game specific. It depends which systems you need to disable while playing the timeline.

    Do I manually need to add a check to pause scoring, movement etc. when the cutscene is playing or not ?

    That's one approach. Explicitly enabling/disabling those systems before and after is another.

    Furthermore, can I reset the position/transform of the character back to its original in game (before the cutscene) after I have changed it in timeline animation (after the cutscene) ?

    That's a great question, and the simple answer is you will need a custom script to do that. Timeline doesn't restore the character position. e.g. Store the position, play the playableDirector, when it's complete, write the character position. Alternatively, you can animate a separate instance of the character if that's feasible.
     
  3. AlcoleponeHome

    AlcoleponeHome

    Joined:
    Jun 9, 2018
    Posts:
    47
    Can i use timeline to control enabling/disabling components on a gameobject? this would be perfect way to disable player interaction while the cutscene plays