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.
Bump. I’m still having some issues with this. The only thing I can think of that might allow this behavior, to my knowledge unless someone can inform me, is to make a specific menu player controller, posses my pawn with it on menu open, and re-posses with character player controller on exit. But I feel like there should be an easier way than this design.
There is another way. However its not very elegant. You could add a branch after every input with the bool of ?input allowed. This would allow you to change the bool value and block input or change the input to the menu only for that one button if the value is false. I hope that helps.
This is the link that I followed to complete this for anyone else. In the widget class, Override the OnKeyDown/Up events. and on those events check which key is pressed with “GetKey” and do your logic from there. To set widget to have keyboard input, where ever you are creating the widget, with Add to Viewport, add another function for “Set Keyboard Focus” and pass the widget to it. Screenshots are in the link.