I’m trying to get my pause menu to open but it won’t.
I followed this tutorial and it seems to work for him but not for me.
Unity 5 2D Platformer Tutorial - Part 11 - Creating a Pause Menu (part 2) - YouTubeI can’t get the script to appear in the functions when try to assign them in a canvas’ buttons either. I don’t know if that would be why or not.
using UnityEngine;
using System.Collections;
public class PauseMenu : MonoBehaviour {
public GameObject PauseUI;
private bool paused = false;
void Start()
{
PauseUI.SetActive (false);
}
void Update()
{
if(Input.GetButtonDown("escape"))
{
paused = !paused;
}
if(paused)
{
PauseUI.SetActive(true);
Time.timeScale = 0;
}
if(!paused)
{
PauseUI.SetActive(false);
Time.timeScale = 1;
}
}
public void Resume()
{
paused = false;
}
public void MainMenu()
{
Application.LoadLevel(1);
}
public void Quit()
{
Application.Quit();
}
}