Press a key to open and close an widget

Hi! I tried to create a basic settings menu for a multiplayer game and i want to open and close it pressing a single key, so I made this:

If I play the game I have to use “Set Input Mode Game And UI” to cancel it by pressing a key, but this will keep the others inputs on (such as player movement, ADS etc.). How can I set this to get rid of the other inputs?

I’ve assuming you’ve looked at how the wiki pause menu tutorial handles inputs? Is it specifically that the tutorial makes you click on “Resume”, while you want to use a key?

Instead of using “Set Input Mode Game And UI”, you might want to look into adding a keyboard shortcut for your UI. Piosnita’s response to this question does it using delegates, though I haven’t tested it myself.