Detect if mouse is over any UMG elements

I’m currently highlighting things in the world by doing a raycast using GetActorByChannelAtScreenPoint.

However I’d like to skip this any time the mouse is over any UMG elements.

Is there a way to detect this?

AActor is already have code to detect mouse hovers and clicks and had delegates you can use

They puts UI in to account, you also need to set bEnableMouseOverEvents to true in player controller, this able line tracing so set it to false when you don’t need it