- Home /
Stop clicking through a GUI window
Hi
I have a GUI menu in a game I'm working on for IOS. One of the buttons opens a GUI window which fills the screen, loads ontop of the menu and has its own set of buttons. My problem is I am able to click through the GUI window and select one of the buttons in the menu. Is the any way to stop this.
I sure there is a simple solution to this.
Thanks.
I don't know if it'd work in that specific instance, but if you want a really quick & dirty solution, you can often just put a box there that covers up the whole screen/scene, turn off it's mesh renderer (so it's invisible) and leave the collider on it alone, which should catch the clicks.
The proper solution would be to test against a variable, like Phillip mentioned. But while this is FAR from elegant, it's very helpful in some situations.
Answer by Piflik · May 03, 2012 at 01:39 PM
Add a variable that is set false when you open the second window and test against it in the menu.
Is there no way to simply ad a collider or something similar to stop the click through?
Answer by Berenger · May 04, 2012 at 03:01 PM
Physic things won't stop the GUI from being clicked, unless you are using GUITexture / Text and OnMouse...().
You'll need a reference to the script displaying the menu GUI so you can disable it when the window is opened. You don't to draw things you won't see.
Your answer
Follow this Question
Related Questions
Blocking Click through on GUI components 0 Answers
Add EditorUI elements when a button is pressed 0 Answers
New GUI and Inventory problem. 1 Answer
UI - click through image 2 Answers
After Adding GUIStyle to GUI.Button, it is no longer clickable 1 Answer