Get widget under cursor?

Hi, I’m looking for a function that tells me what (if any) widget the cursor is currently over/hovering. I was pretty sure I had already found something for this some time ago, but either I remember wrong or I can’t find it now.

The goal is to deal with widget-click-events for buttons other than LMB, and maybe some other fancy stuff later.

I could implement OnStartHover and OnEndHover for each GUI-element, so they register and unregister themselves somewhere as the “global hovered element”, to be checked when any RMB/MMB-click events occur. But that doesn’t feel right… All I need is a function to call in a click-event that scans the cursor position for any widgets.

There’s probably some class for this sort of thing, but I don’t know where to look. The player controller doesn’t seem to be it.

edit: it’s probably clear, but I want to get the specific item, of course, not the whole widget.

1 Like

Ever found the way to do it in Blueprints? The Problem with MouseHover events they are per widget which means EVERY relevant widget has to implement them and report back to central parent/singleton. Another issue is that when Widget is brought up in Viewport the event is not generated and your cursor may be outside of specific widget so now state is undetermined.

What I have is screen position coords and I want to “cast down” UI layout and see if i hit any UW.