I have a menu with different GUI Buttons, but when the menu scene is loaded, there will be show up a window in the centre of the screen. With a button to close the window. No my problem is, if the window shows up, it’s not possible to click the buttons of the menu scene untill the window is closed. Please help me!
Thanks in advance
EDIT
The GUI Buttons should stay visible. you re only not allowed to click on them
Just set GUI.enabled to false whenever you want to disable certain elements. GUI.enabled behaves like a state-switch, so all GUI controls that follow a GUI.enabled = false statement will be disabled.
Example:
void OnGUI()
{
GUI.enabled = false;
GUI.Button(...); // this is disabled
GUI.enabled = true;
GUI.Button(...); // this is enabled
GUI.enabled = false;
GUI.Button(...); // this is disabled
}
You can use boolean variables to switch certain elements off / on.
bool showWindow;
bool showButtons;
void OnGUI() {
if (showButtons) {
// Make the GUI.Button(s) here
if (GUI.Button(// Parameters) {
// Do something
// and toggle the window, if this is the window button
showButtons = !showButtons;
showWindow = !showWindow;
}
}
if (showWindow) {
// Make the GUI.Box here or whatever it is
if (GUI.Button(// Parameters) {
// Do something
// and toggle the window off again
showButtons = !showButtons;
showWindow = !showWindow;
}
}
}