Switchable pause issue

Hello. I’m trying to make a pause, but I want to be able to switch it’s states as on/off using the same key. I’m using checkbox Execute when paused, but if I do it like that:


then I can only switch on pause menu.

If I use get player controller with player index = 1, then I can switch my pause menu off, but getting this error and can’t use mouse:


Any advices?

If you switch to UI Only mode, the player controller cannot receive input. We took that processing ability away.

The easiest way to go around it, is to override onKeyDown in the widget that pops up (full menu), make it keyboard focusable and give it keyboard focus. The widget can then handle the keypress, set the mode back to Game Only and close itself.

Alternatively, the widget can call the top bit of the script above. But you still need to handle keypresses in the widget since we’re now in the UI Only mode.

And yet another alternative is to go Game & UI mode. If the widget does not Handle input, it’s passed on to the PC.

1 Like

Yes, it works, thank you very much. I chose Game & UI mode, override onKeyDown is too complicated for me on that moment.

In case you ever decide to revisit:

  • in the player

  • in the widget:

  • the widget’s root also needs this:

image

Very appriciate for wasting your time on me :blush:

1 Like