How to get keypress in UI only mode?

So I have a pause menu and right now I can pause it by hitting esc and unpause it by clicking a button. However, I would like to be able to unpause it by hitting the same key. The problem is that you can’t get a keypress in UMG. Also, the “was input key just pressed” node doesn’t seem to work and I’m assuming that’s because it’s in UI mode and doesn’t listen for the keyboard. What is the workaround for this?

FirstPersonCharacter Blueprint where game gets paused

my Pause menu widget blueprint

Maybe using Flip-Flop could help? It detect key press and will open menu, then it detect the same key press second time and it will close menu. Then it repeat this loop forever when you press that key.

the answer to this is over-riding the OnKeyDown Event function in the UMG widget.

Then you can use the event to detect which key was pressed and perform the action you require. This is because you are using Set Input Mode UI Only. This means the UI will listen for all keypress events.

IMHO the best and light and elegant solution is to check “Execute When Paused” checkbox under Details of Input Key Event Node. Works perfect!

Try this solution, answered in another post… link text

If you use “set input mode game and UI” it works perfect, at least for me :slight_smile:

Another option is to only “Disable Input” on Controlled Pawn.