Once the player holds RMB, the cursor is shown to the player, the input mode is switched to game and UI mode and the movement of the mouse no longer makes the camera move. I’m using this mode to allow the player to click on actors placed in the world.
Once an actor is clicked, they display a unique UI element to the screen that only takes up a portion of the screen and has buttons on it allowing the player to direct the actors behaviour (Example: Activate a skill move).
(My screen capture doesnt capture the mouse cursor for some reason but in reality, the mouse cursor is visibile in the above image)
When I click on the actor the first time, it brings up its unique abilities bar, from there I can either click on the button on the UI element or click on the world (select a different actor and so on), so far so good.
(Button on UI element is pressed and registered; String is printed to screen for debugging)
The issue is though, If I click on the world, I can no longer click back on the button in the UI element (it becomes inactive for some reason). I want to be able to click on the world without the UI elements buttons becoming inactive (Cannot not click on them).
Assistance would be greatly appreciated, more than willing to provide further detail upon request… Many thanks!
Just to be clear, the mouse cursor not showing is not my issue, the hidden cursor by default is intended (i only want the cursor to show when the player holds RMB and that is implemented and works as intended too, its just that the screenshots dont show my cursor for some reason)… the cursor shows perfectly, its just that if i click on the world, the buttons on the UI element becomes inactive (still on the screen but i can no longer click on it)
I’m certain we do not enter game only mode when we click. I suspect it has something to do with the Game and UI input mode (Image shows the description of the node):
I suspect when the click is not handled by the UI, it gives “player input / player controller” a chance but it doesn’t ever switch back to allowing the UI to handle the click. Any ideas?
does the widget have enough hit-testable elements to start with?
have you tried setting widget focus with the Game and UI input node
Place a regular native button in the widget as a test (if you have none), they are infamous for stealing focus whenever hovered/clicked. Can you click a simple button? If you cannot, it’s time for the Widget Reflector debugging:
Check if mouse cursor is on (dont want anything to happen if its off)
Then check if we have a ref to an actor, if we dont, we get the ref to the actor under the mouse (line trace) and get the actor to show its UI elements through a BP interface. If we already do have a ref to an actor, we tell it to move to the spot under the mouse curor.
Here is a screenshot of the widget class, the mouse cursor is hovering over the button (just noticed the screenshot is still not capturing the cursor, the button is the grey box with blue outline):
The strange thing is, the button works perfectly fine if i click on the button before clicking on the world… but once i click on the world, the button becomes inactive (just doesnt detect clicks)
And i have already tried the focus widget thing, no change.
the widget (or its parent) is set to be not hit-testable
the widget is disabled
another widget consumes input
UI goes first in Game and UI mode; if unhandled, it tunnels to the PC. You cannot un-handle a button unless you actually use a precise-click. And even then, it’d be a hassle. I stopped using buttons for that reason alone - you just cannot shake them off.
Consider having a look at the widget reflector - it is a tool designed to handle this.
You need to use it in PIE - Play in Editor - while you play. In the actual viewport of the game, when the issues manifest. In short, run the reflector, run the game, mouse over stuff that misbehaves, observe the list. Is the cursor hitting what it should be hitting - the button?
Is this a regular native button? I must say that I have not seen behaviour like this before. Hard to imagine what could be causing it. Not even sure how to repro this.