Download

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 here, 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.

Any thoughts are appreciated.

Zach

903645c2cdee45dda9c3d24b999285acdd8f3b77.png
Img2.png

This is something simple…
Start easily debugging… u → is in viewport? → true / false → add/remove from viewport

I know how to debug…

Stepping through 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.

hmm, then i think you can try to remove wire to “in widget to focus”, left it blank, i read somwhere “focus” is something like where your keyboard input goes in (because keyboard can add words only to one “window”), so probably that consume your keypress, but im really not sure :slight_smile:

Yeah that was the first thing I tried :confused:

There’s another function called Set Keyboard Focus that I tried as well but didn’t see any change in the results.

I guess I can also clarify that when I remove the Set Input UI Only node, the toggle works fine without any issues (except the player can also still move and look around, which is super annoying when you’re moving the mouse to click the slider and its also moving the game camera at the same time).

This looks like a challenge. Ill try to recreate this when i come home (in 10 hrs.)

2c: Haven’t had much luck with any of the Set-Input BP nodes.
One workaround is to use Gates triggered by Remote Events.
Basically to shutoff where Inputs shouldn’t go in a given state.

Not what you want to hear maybe, as its more work to code…
But nothing gets filtered / movement can continue if needed!

Obviously check Consume-Input is Ticked-Off where it must be.
To debug add a dedicated Keyboard Event inside each Widget…
Very noticeable where you do things like Pausing the Game etc.
I use Gamepad/Mouse/Keyboard so can’t rely on focus anyway.

well, i tried it, but i was unsuccessful. Its probably designed to do this, so imo only way is c++…
edit: or cheat this → pause the game and manually disable player input…

The more likely solution is that it simply wasn’t designed that well to begin with :rolleyes:

Guess I’ll drop yet another blueprint in favor of C++. Blueprints are turning out to be the most useful, useless tool I’ve encountered in game development. It’s like they had a great idea and executed it to about 95% quality, but that last 5% has its claws in nearly everything you’d end up needing eventually, and you’re more or less stuck hoping Epic staff responds and makes tickets for you so you can get it fixed in ~2-3 months at best.

However, some of this problem I think might be my own error and I simply haven’t caught it yet - could be the order of my nodes or some race condition I’m unaware of.

https://answers.unrealengine.com/questions/676174/set-input-ui-only-removes-keyboard-input.html

I figured I’d also post my fruitless Unreal Answers thread here to sync them up.

Pinging again. Epic, any response?

You need to set input to Game an UI.