Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Implementing Pause in the game, taking into account timelines

Discussion in 'Timeline' started by Suduckgames, Jun 19, 2018.

  1. Suduckgames

    Suduckgames

    Joined:
    Nov 28, 2016
    Posts:
    147
    I am implementing the pause state for my game.

    I was getting problems with cinemachine and timeline, because when I "paused" a timeline, the cinemachine stop blending and go back to the main camera, and the player don't expect a pause action that change the camera.

    I solve it with director.playableGraph.GetRootPlayable(0).SetSpeed(0);

    However, there is some timelines that control the timeScale with a courutine that check if the timeline has been completed.

    The problem come with the timelines with wrap mode "None" since the only way to check if they has "completed" is to check if they are playing but since they can be paused for the pause menu, the courutine take it as a "completed" action and set time scale to 1.

    Any ideas of how I can workaround this?


    I am using 2017 unity version
     
    LezTusi likes this.
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,038
    You can use PlayableDirector.playableGraph.IsValid(). The playableGraph (i.e. the timeline instance) is destroyed when it's finished playing in "None" wrap mode, and that call will return false. If it's truly 'paused' the graph still exists.
     
  3. Suduckgames

    Suduckgames

    Joined:
    Nov 28, 2016
    Posts:
    147
    Thank you very much now is working, however I somehow found a bug, after a while working on the same scene with the timelines, The timeline state doesn't go to Playing. I need to restart unity in order to make it work as normal.

    I still didn't found a patron for the bug