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.