Hi everyone,
I have a GUI Button I would like to hide when I click on it. I’ve attempted to code it, but no luck so far. Here’s what I have so far. Any help would be much appreciated.
var buttonWidth:int = 200;
var buttonHeight:int = 50;
var spacing:int = 100;
var windowOpen = true;
function OnGUI() {
if (windowOpen)
{
GUI.Button(Rect(Screen.width/2 - buttonWidth/2, Screen.height/2 - buttonHeight/2 - spacing, buttonWidth, buttonHeight), "Click to Close");
{
windowOpen = false;
}
}
}