- Home /
click on GUI button goes through to a collider...
I show a menu when the player hits ESC with GUILayout stuff. Now when I hit my "Resume Game" button in that menu, the click seems to go right through the GUI and a collider behind it is triggered too.
To prevent this, I did this:
void OnMouseUpAsButton () {
if (GameGUI.menuDialog == false) {
ReactOnClick ();
}
}
The GUILayout.button reacts only after the mouse is up again and then sets GameGUI.menuDialog = false (the menu sets it to true initially)
However the Collider still gets the click.
I even did:
myTile.gameObject.renderer.enabled = false;
myTile.gameObject.collider.enabled = false;
when the menu pops up, and:
myTile.gameObject.renderer.enabled = true;
myTile.gameObject.collider.enabled = true;
when it closes. But still the collider recieves the click.
I know this is a tricky one and the problem might even lie somewhere else, but I´m pretty clueless here right now. Perhaps someone had similar problem already and can give me a hint or so?
Your answer
Follow this Question
Related Questions
NGUI: Button don't detect input if parent change position on-screen? 1 Answer
GUI.Button press (not click) 3 Answers
Stop clicking through a GUI window 2 Answers
Closing/hiding an open Gui Button when clicking on it 1 Answer
android and ios - phantom UGUI Button click when loading new scene w/ finger already down 1 Answer