Blueprint Close Option HUD with same key as Opening Menu (ingame)

Hello, i actually made a opening main menu with Escape key, and i would to know if it’s possible to press the same key in my option menu to close Main menu/Option menu.
Here’s my blueprint, thanks for answering.

sure, but it depends on how you want to handle input while you are in UI mode.

If you want the widgets to read input and handle it, you override the On Key Down function. Usually people do this in a base class for their interactable widgets.

You could also read all input in the player controller, and route it to desired location by switch or branches. In that case, you need a way to determine the active widget, which should handle the input.

Some nodes that you’ll want to be familiar with:

Player Controller > Set Input Game Only
Player Controller > Set Input Game and UI
Player Controller > Set Input UI Only

1 Like

Thanks for answering, i understood the logic but i dont get how i can add this to my blueprint :thinking: I’m new to blueprint code, Can you show me something how to please ?

2 Likes

I tryed to do all what you told me, and thanks for it !
But i still have problems.
I restarted from the start, deleted everything and try to make it clean as i can, but my menu still has problem, i explain.
-It is a Third person/First person game (switch is possible) and it doesnt work on my first person view.
-I’ve got Option button and Resume button, when i resume the game with “Resume button” , i can’t reload Menu with Escape key. And when i am in my Option UI i can’t resume the game while pressing Escape to make a faster back to the game.

Help me :frowning:

Can you show the keydown implementation in the widget?


I’ve solved some problem !
I can now open and close my Menu with Escape BUT if i click on my resume button, and want to open it again, it doesnt work.
But now i’m looking to close my Option UI with the same input than to open my Menu UI. Or just set my Escape input desable to not open a second Menu UI while i’m in the Option one

Thanks for the helping until here, you’re so nice !

Escape BUT if i click on my resume button, and want to open it again, it doesnt work.

Because buttons steal focus. There’s a hack or two that could work but the best solution is to avoid buttons. Make your own button out of a border.

1 Like

Thanks man i will try to do my best so ! Gonna work hard to find a solution

You could try this:

image

May just work fine.

Thanks for clues i will try to improve… xD