So i am making a Main Menu in C# and it does not work properly
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour
{
private bool Options = false;
void OnGUI()
{
if(Options == false)
{
GUI.Box (new Rect(0,0,Screen.width, Screen.height),"Main Menu");
if(GUI.Button (new Rect(Screen.width/2 -50, Screen.height/2-260, 100, 25),"Singleplayer"))
{
Application.LoadLevel(2);
}
if (GUI.Button (new Rect(Screen.width/2 -50, Screen.height/2-230, 100, 25), "Multiplayer"))
{
Application.LoadLevel (1);
}
if (GUI.Button (new Rect(Screen.width/2 -50, Screen.height/2-200, 100, 25), "Quit game"))
{
GUI.Label (new Rect(Screen.width/2 -50, Screen.height/2- 220, 100, 25), "Are you sure?");
if(GUI.Button (new Rect(Screen.width/2 -50, Screen.height/2-200, 100, 25), "Yes"))
{
Application.Quit();
}
if(GUI.Button (new Rect(Screen.width/2 -50, Screen.height/2-170, 100, 25), "No"))
{
Application.LoadLevel(0);
}
}
if (GUI.Button (new Rect(Screen.width/2 -50, Screen.height/2-170, 100, 25), "Options"))
{
Options = true;
}
if (Options == true)
{
GUI.Box (new Rect(0,0,Screen.width, Screen.height),"Options Menu");
if(GUI.Button (new Rect(Screen.width/2 -45, Screen.height/2-260, 100, 25), "back"))
{
Options = false;
}
}
}
}
}
so when I press Quit Game nothing happends
and when I press Options it just goes black and
the back button does show up.
I don’t know what’s wrong so please help me.