Change Click Functionality When Cursor Over UI

I need the left click functionality that I have built using this tutorial disabled when I am hovering over my UMG windows.

Creating an MMO-style controller in Unreal Engine – Jacob S. Hughes.

When left click is pressed I need a way to check if the cursor is currently hovering over any part of the UI. Every way that I have tried always returns the boolean as false when my cursor is hovering over the UI. I cannot currently interact with the UMG Windows because my camera rotation system takes over. I am trying to disable the camera rotation while the cursor is hovered over a UMG Window.

My most recent attempt was to use the On Mouse Enter event, but that still returned false when hovering over my UI.

220325-mouse-enter.png

The visibility of the UMG windows is toggled using this,

And for good measure I am making sure my cursor is able to interact with the UI.

I have also tried the Is Hovered function and creating an invisible button over my widget to use the OnHovered event as well. I’m out of ideas and am looking for help on this. Thank you.

Set Inpute Mode to Game and UI. UI will get input Events before Game. If you overwrite the Mouse Click in your UMG and return “Handled” it will stop your Mouse Click going to any other Game Objects or UI element bollow.

Just be aware your UI is like a Stack of Papers and the first thing on top recives the Events and decides if its “Handled” or “Unhandled” meaning by that if it should send the same event to the next UMG element bellow or not.

If you still run into trouble or have trouble understanding it let me know. I kept it short gotta run to Work =)

1 Like

Thank you for the response. I have added Set Input Mode to Game and UI on Event BeginPlay. I also overwrote the On Mouse Button Down function in my HUD BP and added Handled to the Return Node.

This worked somewhat. I can now interact with my UMG windows which is great. However, when I click on the environment to rotate my camera, it only works every other click. One click and hold does nothing, when I repeat the action it works. Also if the cursor is moving at all during a click nothing will happen regardless of how much I click. I’m a bit stumped at why the HUD Widget handling mouse button down would interfere with the InputAction LeftClick but only every other time.