Reputation: 11
When I create a UI pause menu in Unity, I adjust the timeScale to make it pause. Is there any other way?
I want to adjust the pause in Unity not by adjusting the Timescale.
Upvotes: 0
Views: 121
Reputation: 153
Create a Pause Event and subscribe objects you want to pause. Then invoke your event and do pause-function on every object. For example:
public event Action Pause;
private void CallMenu(){
Pause?.Invoke();
}
GameObject player:
private void OnEnable(){
Menu.Pause += OnPauseCalled;
}
private void OnPauseCalled(){
player.movement.enable = false;
}
Upvotes: 1