I have followed a tutorial to implement a pause screen for my platformer game. I followed it thoroughly but could not get it working. When I press the escape button which I assigned under the project manager under the name "Pause", it just doesn't do anything. I checked with the Scene view as well, nothing appears. Any help would be appreciated.
Edit: The script is a component of the Main Camera, not the Canvas or the PauseUI itself.
public GameObject PauseUI;
private bool paused = false;
void Start()
{
PauseUI.SetActive(false);
}
void Update()
{
if(Input.GetButtonDown("Pause"))
{
paused = !paused;
}
if(paused)
{
PauseUI.SetActive(true);
Time.timeScale = 0;
}
if(!paused)
{
PauseUI.SetActive(false);
Time.timeScale = 1;
}
}