- Home /
Let Click go through GUI
I must be the first person to ask this, since I only see people asking the opposite...
I'm drawing my GUI this way:
function OnGUI() {
GUILayout.BeginArea (Rect(posX, posY, szX, szY));
GUI.Box(Rect(0, 0, szX, szY), Title);
Draw();
GUILayout.EndArea ();
}
But it blocks clicks from passing through it as normal, how can I deactivate such feature?
Thanks!
Comment
I have objects behind the GUI with On$$anonymous$$ouseUpAsButton() declared that do not respond when the GUI is in front.
Best Answer
Answer by hvilela · Oct 19, 2012 at 11:56 PM
One alternative is to replace your OnMouseUpAsButton by Raycast calls. It's not elegant, but works.
var hit : RaycastHit;
if (Physics.Raycast (ray, hit)) {
// Your code here
}
Your answer
Follow this Question
Related Questions
Prevent mouse click through GUI Texture?!?! 0 Answers
Stop clicking through a GUI window 2 Answers
Blocking Click through on GUI components 0 Answers
Player Fast Travels 1 Answer