Simple really: when I use Set Input Mode UIOnly, I partially get what I want: I can’t click on anything in the game world, just widgets in the HUD.
But irritatingly, I can the cursor moving over actors in the game world still causes them to respond (i.e. OnBeingCursorOver events fire still).
I’m not sure if this is a bug yet - hopefully I am missing a setting somewhere. Obviously, one solution is to have all my OnBeingCursorOver events check some flag to see if they should react, but this seems like overkill.
Did you Lock Input to Viewport? Can you please show us a screenshot of your setup? If for whatever reason this doesn’t solve it, try to set a bool, and not allow the mouse over event to fire if UIWidget is Added to Viewport. And once your remove from parent, reset that variable and allow the mouse over events (in game) to work.
Hi Victor, I can confirm, locking to viewport doesn’t change the behaviour. I’ve just done a fresh test:
-
New project, blank, blueprint, no starter content.
-
In the level blueprint, set the UIOnly setting on BeginPlay().
-
Made a blueprint with a cube that has colour states for (1) default [green] (2) cursor over [yellow] and (3) mouse down (clicked) [red].
-
Modified the player controller to allow click events.
And I get the same behaviour as in my main project - on mouse over the box turns yellow to show it is still received mouse-over events. But it doesn’t go red when I click. Seems unintended to me.
If I understand your solution correctly, then it would work but not be very neat. Wherever I had a mouse-over event I would have to check this boolean variable and I’d rather not do that obviously. Would be nice if UIOnly did as it sounds like it should.
In UMG UI Widget: “Event Construct”->Set “Is Focusable” to true
Unfortunately, this makes no difference. Actors in the game world are still receiving begin- and end-cursor-over messages with UIOnly active.