yujinkim
yujinkim

Reputation: 11

Is it possible to create a pause other than adjusting the Unity Time.timescale?

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

Answers (1)

Koma
Koma

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

Related Questions