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?
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:
I also found out on how to check if your widget or anything in it is focused. Just check for bool value of HasAnyUserFocus || HasHasUserFocusedDescendants . If the focus is lost you can set it using SetUserFocus.