- Home /
Prevent mouse click through GUI Texture?!?!
Hi Guys, I appriciate any help you can offer, I have looked around but cant seem to find a proper solution to this problem. I have GUI textures in my scene, and pressing them activate scripts. On being a "Buildmode" which places cube objects in my scene. Single clicking the gui texture to activate this mode works, but the mouse click also goes through the GUI texture and places a cube object in my scene. Here is my code:
function Update () { if(Input.GetMouseButtonDown(0)) { if(tex.HitTest(Input.mousePosition)) { if(mode.buildmode == false) { tex.texture = ontex; mode.buildmode =true; } else { tex.texture = offtex; mode.buildmode = false; } }
} }
I need build mode to be enabled but prevent the button being clicked through.
Thanks in advance for any help you can provide, James.
Your answer
Follow this Question
Related Questions
GUITexture Button? 1 Answer
Stop clicking through a GUI window 2 Answers
GUITexture click detection problem 1 Answer
Can you use GUI.DrawTexture to make a clickable button 3 Answers
Blocking Click through on GUI components 0 Answers