How to make HUD ignore mouse?
In my game, the player walks around using the mouse and can type text using the keyboard. I've got a UMG with a text field that accepts keyboard input. There are no other interactive elements in my widget, and I don't need to use the mouse cursor to switch between anything.
When I use Set Input Mode Game and UI, I lose control of the game character, and moving the mouse no longer controls it. I'm already setting focus on my text field manually, so I would really prefer the UMG to just ignore all mouse input altogether.
To be more precise, I want to achieve the following result:
Is it possible to do this?
Also, the cursor doesn't disappear even though I have Hide Cursor During Capture enabled.
asked May 15 '15 at 03:03 PM in Using UE4
This is a bit tricky to find out but I found a simple way to do it. I'm not sure what way you're using to get the UMG to appear or if it is persistent, but in my example I'll be using T to spawn it, and Enter to make commit changes and make it go away.
First we set up the PlayerController blueprint to activate the widget. I first add a 'T' event and link it to CreateWidget and Add to Viewport node so that it'll spawn the textbox when I press T. I then add the Set Keyboard Focus and set the reference so that it'll let the keyboard enter input to the widget instead of the PlayerController once it is spawned.
Then we set up the widget. I made a 3D widget blueprint with a text box and a few letters for default text. I then added 'OnTextCommitted' as a function to the event graph. I set it to give input of the game back to the controller and then remove the widget.
I hope this is able to help!
answered May 15 '15 at 05:19 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here