Answer the question
In order to leave comments, you need to log in
How to implement active pause?
I saw a pause solution with Time.timeScale = 0, but in theory it’s not very suitable for an active pause, because the camera and gui should remain working
Answer the question
In order to leave comments, you need to log in
You can create a class that inherits from MonoBehaviour, let's call it MonoBehaviourPaused, add protected bool IsPause to it, and check this property in the necessary checks. This way you can pause individual components at any time. You can also add PauseManager, create the SetPause method in it, as well as the IsPauseGlobal variable, and add a static List ActiveList to MonoBehaviourPaused, as well as 2 OnEnable and OnDisable methods, in OnEnable you can check for IsPauseGlobal and set IsPause, as well as add this to static sheet, and in OnDisable to remove from this sheet. In the SetPause method in PauseManager, you go through the MonoBehaviourPaused.ActiveList sheet and set IsPause to everyone, so you can set IsPause to everyone in one line, and only active components will be set.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question