- Home /
Close (X) button
How can I add close(X) button to the window like this screen?
Now I have the following window:
Comment
Best Answer
Answer by syclamoth · Sep 20, 2011 at 06:41 AM
You will need to manually define a toggle button in the corner of your window, which sets a variable that will set whether to display the window in question. Something like this:
bool showWindow = true;
if(showWindow)
{
GUI.Window(whatever options)
}
Then inside your Window function, have a button like this-
showWindow = !GUI.Button(wherever you put it, "X");
This will make the window disappear when the button gets pressed.
Of course, you will need to set showWindow back to true if you want to display the window again!
Your answer
Follow this Question
Related Questions
Close()ing an EditorWindow 2 Answers
GUI Window problem 2 Answers
GUI Rotation 1 Answer
Don't show window close button 1 Answer
GUI.Window only shows for one frame under all circumstances 2 Answers