Greetings,
Sorry if this is a really stupid question, but I’m having problems and the scripting reference doesn’t really address this. (n00b alert)
At the start of my level, I want to draw a GUI box displaying text about what the player will do. I want a button in the box which, when clicked, will destroy itself and the box (" a close window" button). I am having heaps of trouble figuring out how to remove/destroy GUI elements.
Here is my code. The button removes the box, but I don’t know how to get it to remove itself! Any help is much appreciated.
private var showDest : boolean = true;
function OnGUI()
{
if (GUI.Button (Rect (Screen.width/2,Screen.height/2,100,100), "Begin")) {
showDest=!showDest; //GUI button that closes window displaying destination
}
if (showDest==true) {
GUI.Box(Rect(Screen.width/2,Screen.height/2,500,200), "Find your way to "+ destinationname); //display GUI box at start of level which shows player their destination.
}
}