Download

How do I handle action mappings when a UMG widget has focus?

There is a problem with UMG where if you focus a widget, the Player Control will no longer handle action mappings. For example, I have a Player Controller in my game that handles a custom InputAction that I have defined, PauseButtonPressed. Upon pressing the button the first time, I show the menu and set focus to it. However, if I press the pause button again, it won’t un-pause. From what I can tell, the Player Controller doesn’t handle input events at all when a widget is focused.

Is there some way around this, or is this just a bug? It seems like it would be nice to have this as an option on the Player Controller. Thanks in advance!

Are you pausing the game when you do this, if so make sure the events are set to operate when paused.

I’m not actually pausing the game, just showing the menu. If I don’t Set Input Mode to UI, the action mapping works fine, but I need the menu to have focus. So it definitely has something to do with the widget having focus. :frowning:

Setting the Input Mode to UI Only, means the UI will be the only receiver of Input. The player controller will disregard all incoming input that fails to be handled by the UI. If you’d like the player controller to continue to get a shot to process input after the UI has had a shot at it, you need to use “Game and UI”, however it will be up to you at this point to ensure you’re pausing the game / ignoring other actions you receive while the UI is up.

Hey Nick, thanks for the response!

I’ve tried setting input mode to “Game and UI”, but it still isn’t working, although there is something interesting happening. Upon showing the pause menu, I cannot receive input events on the player controller as usual, but if I click with the mouse on an element in the menu, and then click outside the menu in the game space, the input event can be handled at that point. This doesn’t work if you just click directly in the game space without clicking something in the menu first.

Perhaps there is a better way for me to pause/unpause them game besides using key events on the player controller. If you were to do it now, how would you go about it? Thanks!