- Home /
Is there a way to activate a timer from another scene?
I made an energy system lately and it only starts regenerating and losing the energy when the Scene that has the Energy GameObject is opened.
I am wondering if there is any way for the timer to start if i lose a life in another scene. Because in this state if someone exits the game from a Level Scene and enters it after 2h and enters the Menu Scene with the Energy, only then will the energy be lost and start to recharge. I was thinking about the DontDestroyOnLoad but i dont think it works as its a UI GameObject
Answer by Fadrik · Mar 13, 2021 at 10:21 AM
the best way of action here is to set the EnergyGameObject to don't destroy on load so it'll stay working in all the scenes and also you can keep track of the energy level as a PlayerPref
and by this way, you'll be able to check the energy level whenever you are in any scene