What is the best way to check if the mouse is over a button in an EditorWindow? The buttons I’m using are contained in an Area, which will have to be considered when calculating the button’s position.
Example:
Rect rectArea = new Rect(10f,10f,100f,100f);
GUILayout.BeginArea(rectArea);
Rect rectButton = new Rect(50f,100f,20f,40f);
GUI.Button(rectButton,"Button");
// if (Event.current.mousePosition == ?)
GUILayout.EndArea();
I have offset the rectButton with the rectArea’s position, but hovering over the button, the mousePosition is not close in value to the button’s position. What am I missing here?