Question by
xXSilverswordXx · Sep 20, 2017 at 01:32 AM ·
menupausetimescale
Pause menu unpausing
Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pause : MonoBehaviour {
public bool Paused = false;
void Update () {
if (Input.GetKeyDown("escape"))
{
if (Paused == true)
{
Time.timeScale = 1;
Paused = false;
Debug.Log("Unpausing.");
}
if (Paused == false)
{
Time.timeScale = 0;
Paused = true;
Debug.Log("Pausing the game.");
}
}
}
}
I want to use timescale 0 to pause the game. However, since the update method never runs when timescale is set to 0, the program never gets to check to see if the player is trying to unpause the program.
Anyone know a way to get around this? Thanks.
Comment
Best Answer
Answer by PersianKiller · Sep 20, 2017 at 01:57 AM
change
if (Paused == false)
to
else if (Paused == false)
Your answer
![](https://koobas.hobune.stream/wayback/20220612135222im_/https://answers.unity.com/themes/thub/images/avi.jpg)