- Home /
GUI.Depth text input/button issues
Hey,
I'm trying to use two separate classes with OnGUI at different depths to try and create a "notice box" that appears when certain things are called in the main script.
The second script is added to a separate gameobject instanced from the first script. The first script has a depth of 1 and the second a depth of 0.
However, the text inputs and button on the first GUI are still able to be edited/clocked respectively despite having another GUI on top of it.
Any help would be appreciated.
Thanks!
Answer by SmilingRob · Jun 25, 2012 at 12:37 AM
Inside the if block with your GUI.Button() or whatever was clicked, Use()
the event up: http://unity3d.com/support/documentation/ScriptReference/Event.Use.html
if (GUI.Button(new Rect(buttonL, buttonT, buttonW, buttonH), "Fire'")) {
// use up this event, so it will be marked used for the next button
Event.current.Use();
// ... do something with the event
}
Hey, that hasn't seemed to work, the box on top of the other elements are still clickable... It's kind of annoying since sometimes it causes the elements to double up.