How to find UI element under mouse cursor...

Hello Unity gurus! :slight_smile:

I have a need to find the 3D position of the UI widget currently under the mouse cursor in a 3D scene (i.e. Canvas render into the 3D scene)

I can find when the mouse is over a widget with a call like “EventSystem.current.IsPointerOverGameObject()” but I don’t know how to retrieve that object currently under the mouse cursor.

Is there a way to do this without subclassing each widget and trapping their “OnPointerEnter()” / “OnPointerExit()” calls?

Many thanks!! :slight_smile:

EventSystem.RaycastAll might help.

Hi BoredMormon :slight_smile:

Thanks for taking the time! Will try :slight_smile: