Announcement

Collapse
No announcement yet.

Set Input UI Only - Removes Keyboard Input

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    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

    Click image for larger version

Name:	Img1.png
Views:	1
Size:	378.2 KB
ID:	1225844
    Click image for larger version

Name:	Img2.png
Views:	1
Size:	254.8 KB
ID:	1225845
    Last edited by Zooch; 07-27-2017, 02:35 PM.

    #2
    Originally posted by Zooch View Post
    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

    [ATTACH=CONFIG]149826[/ATTACH
    [ATTACH=CONFIG]149827[/ATTACH
    This is something simple...
    Start easily debugging... u -> is in viewport? -> true / false -> add/remove from viewport

    Comment


      #3
      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.

      Comment


        #4
        Originally posted by Zooch View Post
        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

        Comment


          #5
          Yeah that was the first thing I tried :/

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

          Comment


            #6
            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).

            Comment


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

              Comment


                #8
                Originally posted by Zooch View Post
                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).
                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.

                Comment


                  #9
                  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...

                  Comment


                    #10
                    Its probably designed to do this,
                    The more likely solution is that it simply wasn't designed that well to begin with

                    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.

                    Comment


                      #11
                      https://answers.unrealengine.com/que...ard-input.html

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

                      Comment


                        #12
                        Pinging again. Epic, any response?

                        Comment

                        Working...
                        X