Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

how to implement a pause screen?

Discussion in 'UGUI & TextMesh Pro' started by sunsflower, Jun 7, 2016.

  1. sunsflower

    sunsflower

    Joined:
    Dec 19, 2015
    Posts:
    16
    I'd like to make a pause screen when esc is pressed in game. SceneManager,LoadScene will unload any previous scenes so it wont do. Using Additive loadscenemode will make it hard to unload the pause screen gui part. Is there any other way to do this?
    thanks very much!
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,521
    Unity's free Game Jam Menu Template may be a good start, or at least something worth examining for ideas. It implements a pause menu using Unity UI. To pause, it sets Time.timeScale=0.
     
  3. sunsflower

    sunsflower

    Joined:
    Dec 19, 2015
    Posts:
    16
    thanks, it is really helpful!
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,521
    Happy to help!
     
  5. sunsflower

    sunsflower

    Joined:
    Dec 19, 2015
    Posts:
    16
    by the way, is it possible to load a scene without activating it(I mean the current scene is still running until I call some SetActiveScene function explicitly)?
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,521
    Your MonoBehaviours receive a message OnLevelWasLoaded(int index) when a level has been loaded. You could manually deactivate all the root GameObjects of the scene using SceneManager.GetSceneAt(index).GetRootGameObjects.