how do I set user focus to allow menu navigation?
I have a menu UI that I'm trying to allow a gamepad/keyboard to navigate but I seem to be setting the user focus incorrectly.
this is what the inventory widget looks like, the inventory slots are custom widgets arranged in a uniform grid element.
and this is where im setting the user focus in the player controller, i have currently set the focus to be the entire inventory widget. this code occurs after the inventory widget is made visible.
when I play the game and bring up the inventory I cant navigate with the keyboard until I press one of the buttons with the mouse, how do I set it so I can navigate with the keyboard straight away?
asked Apr 05 '17 at 07:01 PM in Blueprint Scripting
Did you ever find an answer to this? I'm having the same problem.
answered Jun 24 '17 at 03:24 PM
My solution was to specify a default menu element to be focused to. When you create the widget you set user focus to that default widget. Additionally you can check on Tick if your menu didn't lose focus and refocus on default element if it did. Note that your buttons need to be UserWidgets and that it works well only in InputModeUIOnly, I'm struggling to make it work on InputModeGameAndUI. Here is C++ for that:
Later you need to hook SetInitFocusWidget on Construct with a reference to default element.
answered Jul 12 '17 at 08:57 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here