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

**URL:** <https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [February 24, 2023, 10:08pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039 "2023-02-24T22:08:56Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![oShifto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oShifto](https://forums.unrealengine.com/u/oShifto)\
**Post date:** [February 24, 2023, 10:08pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/1 "2023-02-24T22:08:56Z")

</div>

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.

 ![e129cd84d931b20b3c5f0dc32da90026](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/3/1/f31b9dc1e01c66dac82c78bcda8726017975043f.png)

---

<div class="post-metadata">

**Author:** ![BIGTIMEMASTER](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bigtimemaster/32/710746_2.png) [@BIGTIMEMASTER](https://forums.unrealengine.com/u/BIGTIMEMASTER)\
**Post date:** [February 25, 2023, 1:29am UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/2 "2023-02-25T01:29:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![oShifto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oShifto](https://forums.unrealengine.com/u/oShifto)\
**Post date:** [February 25, 2023, 9:21am UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/3 "2023-02-25T09:21:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 25, 2023, 3:32pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/4 "2023-02-25T15:32:40Z")

</div>

> [@Close menu with same button as opening](https://forums.unrealengine.com/t/close-menu-with-same-button-as-opening/485710/10):
>
> Not stupid at all, actually. It’s just an input processing thing. Set Input Mode UI Only prevents the Player Controller from processing input - pressing M while this mode is active does nothing, the PC ignores it, as instructed. The input is processed in the widget instead since we’ve given it to the UI exclusively - Set Input Mode UI Only You can have it processed by both (widgets go first, though) with Set Input Mode Game and UI node but if you’re making a first person shooter kind of game (…

---

<div class="post-metadata">

**Author:** ![oShifto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oShifto](https://forums.unrealengine.com/u/oShifto)\
**Post date:** [February 26, 2023, 7:18pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/5 "2023-02-26T19:18:17Z")

</div>

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.

 ![Menu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/f/42f008f9f5c9bfa32ed38e869762bea7f88aa153.png)

Help me ☹

---

<div class="post-metadata">

**Author:** ![oShifto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oShifto](https://forums.unrealengine.com/u/oShifto)\
**Post date:** [February 26, 2023, 7:18pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/6 "2023-02-26T19:18:52Z")

</div>

![Menu blueprint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/6/ce627b5eb847fe6fb0eb7d426cc49253cbf47327.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 27, 2023, 9:30am UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/7 "2023-02-27T09:30:39Z")

</div>

> [@oShifto](#):
>
> 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.

Can you show the keydown implementation in the widget?

---

<div class="post-metadata">

**Author:** ![oShifto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oShifto](https://forums.unrealengine.com/u/oShifto)\
**Post date:** [February 27, 2023, 6:03pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/8 "2023-02-27T18:03:44Z")

</div>

![a3658471f209bb827644e9c51fe5310d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/f/3ff4195030458c09c93187ea627cdb555dcfbf24.png)  
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 !

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 27, 2023, 7:52pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/9 "2023-02-27T19:52:49Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![oShifto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oShifto](https://forums.unrealengine.com/u/oShifto)\
**Post date:** [February 27, 2023, 8:05pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/10 "2023-02-27T20:05:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 27, 2023, 8:23pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/11 "2023-02-27T20:23:18Z")

</div>

> [@oShifto](#):
>
> work hard

You could try this:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/a/05ae3fc361413093436732e97e5b48ecbdc537de.png)

May just work fine.

---

<div class="post-metadata">

**Author:** ![oShifto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oShifto](https://forums.unrealengine.com/u/oShifto)\
**Post date:** [February 27, 2023, 8:58pm UTC](https://forums.unrealengine.com/t/blueprint-close-option-hud-with-same-key-as-opening-menu-ingame/778039/12 "2023-02-27T20:58:36Z")

</div>

Thanks for clues i will try to improve… xD
