Set Input UI Only - Removes Keyboard Input

Hi all,

I’ve set up a menu that is supposed to open and close by pressing the U key on the keyboard. When it opens, the mouse cursor appears and movement/look controls are locked so players are only able to use the mouse. When I hit U again, nothing happens. The keyboard input isn’t being read. It’s supposed to remove the menu and unlock the movement controls so the player can move/look around again.

I’ve tried following the dozens of slightly different tutorials on Unreal Forums, YouTube and Unreal Answers, and none of them seem to solve my problem. I’ve attached pictures of my current setup - the one I thought was most likely to work.
I’m using version UE4.12.5

Any thoughts are appreciated.

1 Like

Stepping through the debugger doesn’t present any major glaring issues. I did however realize about 20 minutes ago that my OnKeyDown function works, but I have to first press it to re-enable general functionality, then press it a second time to remove the HUD. I also have to click on my slider and keep my mouse hovering over it before it works. That sounds like it’s losing focus to me.

Name368 from the Unreal Forums also tried to replicate and wasn’t able to get it working either.

franktech also commented, saying he’s not had much luck getting the SetInput nodes to work correctly either.

Pinging again.

Don’t use the UI only node. To disable game input and focus solely on the widget, do the following:

Turn this setting on in your widget:

243358-uikey1.png

Put this node in your widget blueprint.

In my case, I have AbilityMenu assigned in my input settings. So when the key assigned to that action name is pressed, it will fire CloseWidget and close this menu.

243359-uikey2.png

4 Likes

This is outstanding. Thank you!

Thanks, this helped me too.

Another option is to only “Disable Input” on Controlled Pawn.

This was exactly what I needed tysm

I wanted to say this was working for me too, but I don’t seem to be able to get the functionality I want.

In my case, I want the main UI (score / lives lets say) displayed, and then when the player presses a button (key: U) I want game input to sto (e.g. can’t move the player around, or fire), have the mouse appear, and then have the UI elements clickable. When the keyboard key U is pressed again, control should be handed back to the game.

I’ve tried the above approach and I’m getting some very weird scenarios…

Setting Input Mode Game and UI, when the game starts the game itself isn’t focused, so it needs a mouse click to focus it. I also have to hold down either the left or right-mouse button to then rotate the player around. When I press U, the mouse pointer appears but when I click the mouse button, it fires in the game as well. Sigh.

This feels like something that should be really straight forward to do, yet seems incredibly challenging.

I have tried the “Stop Action” (appears to be utterly undocumented at UE4 docs site) - have tried a combination of Game Mode Only and UI Only - no joy with that either.

Open to any suggestions from anyone willing to help :o/

1 Like

Ok, this is old but it appears on google search, so I thought I could share what worked for me.
I’m not making a game but this fits my project as I want.

In my case I want to open the UI and lock movement, since the UI has the “focus” (game and ui mode on the A flip flop node) I can’t look around with the mouse, which is what I want. I also don’t want to click once again to set the focus to the UI or the game mode, the UI works on the first click, the game input works right when the menu goes out and I can toggle the menu without focusing on it (B flow on the flip flop node).

On the pawn:

Input is a bit different on the widget, here we override the “on key down” function:

1 Like