How do i handle action mappings on an UMG Widget?

Hello, on my game when i press the TAB key (Action Mapping for Open Inventory) i create an UMG widget and add it to the viewport i also set the player controller input mode to UIOnly, the problem with that is that i no longer can use the action mappings to close it with the TAB key. How do i use action mappings (it has to be this, because i don’t want to force keys that the user might have change on the configuration) on my UMG Widgets? Thank you

I am having the same problem! I can pause my game using an Input Action, but I can never unpause it once the widget gets focus. Seems like there should be an option to let the Player Controller continue receiving input events even when the widget has focus.

Any updates on this please?

Just wanted to add: I have this problem as well and it’s important because it’s much more intutive to close some menus with escape.

If you’re going to use Escape always to close menus, you can set that key event.

Thank you, but… how?

When I search for an escape node in an actor blueprint I get this:


When I search for an escape node in a umg widget blueprint, no node is found. Copy-Pasting the event node doesn’t work…

I was under the impression that you could do that, guess not :S Worst case on the Event Tick you can use a Is Input Key Down node and check if it the escape key is down. It’s not pretty but it should work.

Search on the palette. i’ve just tried that and you can put it on the umg widget graph.

Hm, I couldn’t find a “Is Input Key Down” node, I’m afraid.

I’m only able to check wether Control, Alt, Shift, etc. are down, but that’s only a few keys.

Oh, my mistake. I had “Context Sensitive” turned on and didn’t see it.

But now I have a new issue. This is my setup in the widget blueprint:

It always prints false, doesn’t matter if I press the key or not.

I’ve never really used that node in practice, so unfortunately i wouldn’t know how to help you :S

When I use that setup anywhere else, it works flawlessly, so I guess it has something to do with setting the player controller mode to input UIOnly.

Thank you for your help!

you can select the input action node and then on the right there’s a checkbox for “execute when paused”.

Will that allow the input action node to be created in the umg widget event graph?

no, i was talking specifically to BaronPumpky, sorry. hm, now that i reread his comment, i think i actually misunderstood it. :wink:

the way i “solved” the problem you have is rather clunky. i’ll make an answer below.

i made a dummy actor, just an empty actor that gets spawned by the player when he opens the menu. on begin play, that actor creates the menu, and disables the player character’s input (using disable input with the character as target and player controller as controller). it also enables input on itself, using enable input.

it then calls set input mode game and ui. that function has a pin for a widget to focus on. important to put the newly created widget in there, otherwise your first click wont work - it will only focus the widget.

this dummy actor also responds to the input action. it basically just undoes everything, removes the menu and re-enables control for the player.

there is one problem with this approach: if you have a textfield in the ui and you press a button that’s also the input action for closing the menu, it will type the character and close the menu. since i don’t think i’ll have a textfield in there, i didn’t bother figuring out how to fix it.

in the screenshot below, i set the focus to hud reference instead of the menu i created, but that’s just something i haven’t sorted out yet. (gotta move some widgets from the permanent hud to the menu).

hope this helps, can’t guarantee any of this is correct or a good idea. :stuck_out_tongue: was kinda surprised you were still interested in such an old question.

edit: just saw that for the enable input for the player character, the target pin is connected to the character and the controller… it still works, apparently, but it only needs the player character as target.

Based on Dividual’s answer, here is how I solved a similar issue. In my HUD class, I handle an event to open/close a window. When opening, if I set the input mode to Game and UI, I had the problem of other input key/mouse events interfering with the functionality of that window. However, if I set the input mode to just UI, then the key to open the window could not be used to also close it. To solve, upon opening the window, I set the input mode to Game and UI plus I disabled input on the player pawn. In this way, the HUD still receives the inputs for opening/closing windows, but the player actions no longer interfere with the open window.