- Home /
Getting mouse over GUI event
I want to get that event so I'll know when mouse is over ANY part of GUI (anything drawn in OnGUI() function).
It's not for getting rollover effect on button texture (I know that you can get that with GUIStyle).
Is there any better way than just checking all Rects I used to draw for Rect.Contains(Input.mousePosition, for Y axis it's: Screen.height-Input.mousePosition.y accualy)?
Something like GUILayoutUtility.GetLastRect() but for freely drawn (not in layout) gui elements?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613080340im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
detect mouseover with grid buttons? 1 Answer
Change GUI on mouse over 1 Answer
Examples of TBS/Heavily Gui-driven Games in Unity? 2 Answers
Unity UI Button touching from far distance 0 Answers
How to check if player is hovering mouse over a GUI Box 3 Answers