heres my code for a pause menu i’m trying to set up and it doesn’t seem to be working right any help would be great i all so get this warning GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced (type:5)
UnityEngine.GUIUtility:EndGUI(Int32, Int32, IDList)
heres the code for you to look at
var isPaused : boolean = false;
function Update()
{
if(Input.GetKeyDown("escape") !isPaused)
{
print("Paused");
Time.timeScale = 0.0;
isPaused = true;
}
else if(Input.GetKeyDown("escape") isPaused)
{
print("Unpaused");
Time.timeScale = 1.0;
isPaused = false;
}
}
function OnGUI (){
if(isPaused)
{
GUI.BeginGroup (Rect (Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 100));
// RenderSettings.fogDensity = 1;
if(GUI.Button (Rect((Screen.width)/2,480,140,70), "Quit"))
{
print("Quit!");
Application.LoadLevel("menu");
}
if(GUI.Button (Rect((Screen.width)/2,560,140,70), "Restart"))
{
print("Restart");
Application.LoadLevel("scene_1");
Time.timeScale = 1.0;
isPaused = false;
}
if(GUI.Button (Rect((Screen.width)/2,640,140,70), "Continue"))
{
print("Continue");
Time.timeScale = 1.0;
isPaused = false;
GUI.EndGroup ();
}
}
}