4.7.3 Disable input while menu is open except one key

Hey everyone,

I was looking to see while my UMG character menu is open, disable player controller until the player closes the menu with the same key. So if I press “C” to open the menu, I want to only be able to close the menu with “C” while disabling all other controls. I do not want to resume input from a widget in the menu.

I looked into Disable Input/ Enable Input and also Set Input Mode UIOnly and Set Input Mode Game Only, but these will not give me the “C” key to fire. Is there an exception to still look for “C” that I can add to these existing functions? I have multiple key inputs and do not want to check if menu is open on all of them.

Thanks for you’re input.

What I did here is when you pause, I clear and bind different input mappings for the menus. Then when you exit the ui, I clear and rebind the player input mapping. Seems to work reasonably well.

That sounds like it could work; I was thinking something along those lines or something like making a dedicated menu playercontroller. As I’m not at my development machine and I don’t know what functions would clear and rebind in BP, can you share what functions these would be?

Thanks for your help with this kylawl.

Bump. Unfortunately kylawl, I haven’t found the way to do this. Can you or anyone share what functions that you can do to clear the current custom action mappings to my character, and re-bind certain custom action mappings from the character or character’s controller?

Its not that hard actually. Override one of the key up/down/press functions.
I believe if you return “Handled” the input is ignored. If you return “Unhandled” I believe the input is processed. You can even check the key against various keys that may or may not have been pressed.

Check out this thread. It shows a little on how to use it.

Thanks awilliams, this is exactly what I needed. Also for anyone in the future I kept the focus of the widget from mouse clicks, regardless of clicking on the buttons, I clicked on [Root], and set Visibility to Visible.