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

Keep updating scene when closed

Discussion in 'Editor & General Support' started by Pandzas, Jul 12, 2021.

  1. Pandzas

    Pandzas

    Joined:
    Sep 30, 2020
    Posts:
    10
    So i have a game where i have multiple levels and a main screen with my UI, i want to load the level scene but keep updating the main screen. Is there a way to do this without using "LoadSceneMode.Additive"?. The reason is beacuse i have a timer that gets text updated but when i close the scene and open it again everything starts over.
     
  2. Epsilon_Delta

    Epsilon_Delta

    Joined:
    Mar 14, 2018
    Posts:
    258
    To my best knowledge, it cannot be done as you described it. But there are many solutions, additive loading is one of them, putting the timer on DontDestroyOnLoad gameobject another.
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    As ED points out above, that's not really what you want to do.

    You want to play the game and update some data, and then when you return to the main menu you want to display that updated data in the bits and bobs on the main menu.

    Traditionally the construct use for this is called a GameManager. It can be as simple as a static class with values in it, or if you need more complexity a singleton, or even just store everything in a shared scriptable object.