I want the “Options” and “kenney” buttons to be deleted after they’re clicked once. I already tried: Destroy(GUI.buttion); and other things along the lines of that, but it won’t work. here’s my javascript:
var target : GameObject;
function OnGUI () {
// Make a background box
GUI.Box (Rect (Screen.width -300,5,250,230), “Main Menu”);
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if (GUI.Button (Rect (Screen.width - 250,40,160,40), "Start Game")) {
Application.LoadLevel (1);
}
// Make the second button.
if (GUI.Button (Rect (Screen.width - 250,100,160,40), "Credits")) {
print("Credits!");
Application.LoadLevel (2);
}
if(GUI.Button(Rect(Screen.width - 250,160,160,40), "Options")) {
print("Options");
animation.Play("Options");
}
//hidden button
if(GUI.Button(Rect(Screen.width - 1920,890,20,20), "kenney")) {
print("kenney");
target = GameObject.Find("kenney");
target.animation.Play("easteregg");
}
}