Set UI Input Only disables UI Input.

Hello,

To the best of my feeble mind’s ability for comprehension, the Set Input Mode UI Only node is meant for things like disabling player input when you want them to look at the pause/escape menu. Which is what I want to use it for.

Except that, as stated by the node description, it disables input in the widget…
image
In essence, this means that only mouse input is accepted. This is a little bit of a problem, as, being an escape menu, I want the escape key to be able to get you in and out of the menu.

In adherence to the comment, my EnhancedInputAction node inside the UI widget stops working when I enter the UI input mode. What am I to do to resolve this dilemma?

PS. Using Game and UI input is not a particularly good solution in my case, as I wish to forbid players from walking around while staring at the menu. I’m sure that there is a simple and straightforward solution to my problem, but alas, I am unable to find it on my own.

Hey @User-400315961!

So strangely, you will typically use “SetInputModeGameAndUI” when there is this situation.

Honestly I have never used “SetInputModeUIOnly” for this! I know it seems strange, but that’s just how it goes.

Give that a try and let us know how it goes! :slight_smile:

1 Like

Oh my, just as I finished writing my edit about Game and UI input mode, I saw this comment. Apologies for the delayed response.

Using this mode does indeed resolve the issue of input not being listened to, but it unfortunately carries the complication that now the player can control their character when they are supposed to be paused.

I could theoretically disable the player controller or have a bool that checks if the player is paused before reading inputs, but I’m sure (or at the very least, I dearly hope) that the engine must feature some method of accomplishing this that is not as hacky and perilous as the ideas that course through my idle thoughts.

No worries! You just use the “GamePaused” node!

Check out this documentation on creating a pause menu! I think it might help you out! Usually these pages aren’t so specific to a problem but I think in this case it’s SUPER helpful.

In my specific case, since I’m working on a multiplayer game, I don’t think I can get away with actually pausing the game. That said, I’ve marked the thread as resolved, since this answer would work for most people who look at this thread (since I assume most games are single player).

As for me, enough cursing at my monitor resulted in the following set-up:


I leverage the enhanced input mapping system having separate contexts to disable the player specific one while still listening to the UI-specific contexts. It’s certainly a lot more elegant than having a bool before every input.

So far, I think this solution works well for my specific case.

2 Likes

Hey, just dropping by since this really helped me at work.

What I wanted to achieve was to have ESC button open and close the pause menu but I couldn’t get any input to work when the menu was set on UI mode so I used the enhanced input system technique you used but with a lil extra flare.

So I set up 2 enhanced inputs, one for general use and one for opening/closing pause menu,
then I created an input action and made sure I ticked ‘on trigger when paused’ in the input action settings, then made the pause menu actually call the node ‘pause game’.

Now add a flip flop or however you want to control the pause menu using the input, you can also add a bool of is active on the widget to update the flip flop/branch so you always get the expected result (in case player opened with esc and closed with mouse)…

Boom!

Now only the Input Action I needed to listen to while the game is paused is working.

If you’re using the old input system then when you click on the event node inside your graph you should have it on the settings on the right.

Also note that with this solution you might not even need the enhanced input split IMC but I kept it in since IMO it’s cleaner and more reusable to split it based on context.

Pause menu documentation:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.