V0.1.2 Devlog - LH


"Issue Receiving Input In UI Menu"

Author: Liam Hans

Posted on: 07/19/24

THE PROBLEM

This week was all about setting up our vendor system, and with the vendor system comes the vendor shop. Ideally, we wanted to set up the shop to be relatively dynamic and quick, so we could tab in and out of it relatively easily. With that being said, we wanted the shop to be openable and closable via a key press, rather than opening with a key and closing with an 'X' or 'Back' button. We want that functionality too, but why limit ourselves to that? So, I thought setting this up would be pretty quick. If we press our interact button near the vendor, open the shop, if we press it again, close the shop. Alas, it was not quite that simple. The issue with this method is that when we open a UI menu, we set the InputMode to 'UIOnly', which unfortunately disables keyboard input. Without keyboard input, we weren't able to close the shop with another press of our interact button, and were only limited to the X or Back button option. I'm not exactly sure why Unreal set it up this way, considering we may want to give UI input via the keyboard as well, but we were stuck with this issue nonetheless. 


THE SOLUTION

I thought my solution to this would be rather straightforward, I could just not set the InputMode to UIOnly and set it to UI and Game Only and simply disable my controller's input so that my player wouldn't move while in the shop. Well, if I disabled my controller's input, that disabled all input, meaning I could not give keyboard input to close the shop once again. I then remembered a similar issue that I spoke about in my blog post last week, where I discovered two rather handy nodes: IgnoreLookInput and IgnoreMoveInput. I thought, "why not try these out and see what happens". Well, turns out they worked. At least, sort of. I was able to ignore my movement input, which stopped the player from moving when in the shop, however action input (attacking, casting magic, changing camera angles, etc.) was not being ignored. So, our player couldn't move in the shop, but they could still perform actions. This would not do. We decided on adding a flag called 'UIMenuIsOpen' which we could then check on all action inputs before performing the action, seeing as we wouldn't really want to attack, cast, change camera angles, or the like while a UI menu is open anyways (a fully immersible UI menu, that is). 


This solved our issue, and resulted in a UI menu that we could open and close with the click of a key! See below for a video example of our vendor shop (please note that the shop itself is not fully complete so there are many items missing/some jankness to the menu itself).

Get Plight of the Gods

Leave a comment

Log in with itch.io to leave a comment.