- Home /
How to make GUI object prevent clicking/touching what is under it?
Hello there.
I am making a Turn-based strategy game.
In my scene, I have a grid of tiles.
I have a few buttons(GUITextures) that are meant to make the player decide whether he wants to move, attack, or end his turn.
As the level is larger than the screen, it is possible to move the camera around. However, this also means that the GUITextures will be above the grid tiles.
On each button, I have a OnMouseDown trigger that changes the state of the game.
On each grid tile, I also have a OnMouseDown trigger. However, I obviously do not want these to trigger when the buttons are pressed.
How do I prevent the click event happening on the tile when the button is clicked?
Answer by getyour411 · May 18, 2014 at 12:01 AM
http://answers.unity3d.com/questions/163218/stop-mouse-click-passing-through-buttons.html
For more suggestions, Google: "unity3d prevent gui.button click pass through"
Your answer

Follow this Question
Related Questions
How to control GUITextures within a single C# script? 1 Answer
GUI Texture Problem 3 Answers
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
GUITexture and GameObject OnMouseDown() Problem 1 Answer
GUI 2D Bounding Box 1 Answer