Here’s my code:
var toggleBox = false;
var toggleLabel = false;
var customSkin : GUISkin;
function OnGUI(){
GUI.skin = customSkin;
// Make a background box
GUI.Box(new Rect(10,10,1260,100), "Planet Domination");
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if(GUI.Button(new Rect(20,40,100,30), "Singleplayer")) {
Application.LoadLevel(1);
Destroy(this);
}
if(GUI.Button(new Rect(150,40,100,30), "Multiplayer")) {
Application.LoadLevel(1);
Destroy(this);
}
if(GUI.Button(new Rect(280,40,100,30), "Options")) {
Application.LoadLevel(1);
Destroy(this);
}
if(GUI.Button(new Rect(410,40,100,30), "About")) {
toggleBox = true;
toggleLabel = true;
}
if (toggleBox == true)
if (toggleLabel == true)
GUI.Box(new Rect(10,150,500,200), "About the Game");
GUI.Label(new Rect(20,170,475,490), "Created in 2014 by Pixel-Made Studios");
}
When I put this code in, the GUI.Label won’t disappear when the scene starts. Can anyone help me?