EDITED QUESTION
I have a script, in which i’ve layed out what i think would be the logical order of things that would need to happen when creating a pause menu.
My question is, once the user presses ESC, how do I display the GUI Panel that i’ve already created using the new UI system. This Panel exists in a canvas which I made in another scene.
Thank you for any help! Even pointing me towards the right set of documentation.
-Jon
using UnityEngine;
using System.Collections;
public class InGameGUI : MonoBehaviour {
private string GUImode = "gaming";
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if(Input.GetKeyDown("escape")) //Pause game when escape is pressed
{
Time.timeScale = 0;
GUImode = "paused";
}
}
public void DisplayMenu()
{
if(GUImode == "paused")
{
//display pause menu here
if(Input.GetKeyDown("escape")) //if escape is pressed to resume game
{
Time.timeScale = 1;
GUImode = "gaming";
}
if(/*add condition for when game is quit*/) //If quit button is pressed return to main menu
{
Time.timeScale = 1;
GUImode = "quitting";
Application.LoadLevel("MainMenu");
}
}
}
}