I am investigating Common UI to see if we should move over too using it and I’ve got one last Hurdle to solve.
I am stuggling to get the keyboard movement to trigger the highlights on the UI buttons.
I have it working with Mouse, Touch and Gamepad but its failing to trigger with Keyboard.
I do get the Blue outline showing the underlining focus system is moving between the buttons and pressing the correct button works but just not the actual button focus visuals.
I have tried following the Unreal Youtube talks and demonstrations and each time even your video demonstrators stop trying to work out keyboard and they ignore this issue for the sake of continuing the video.
As all the other input types work without needing any extra BP logic to function or code to be written to get them working.
I’m wondering if i’m missing something; there is a bug or if there is extra setup too get the keyboard highlighting working?
Mainly Followed the 2nd video and then ported some of the Layer management from Lyra into a standalone plugin so i can try to make it useful for our games.
I have no additional logic for handling Input or focusing in code or BP.
I’m trying to so this as default Vanilla UE5 so i can try to do it the Unreal way before trying to code solutions myself.
I can see the Blue outline showing the current focus when using a keyboard and it selects the correct button but the Hover states are not triggering.
On my screen i only have 1 widget so there is no other widgets to take focus.
Touch, Mouse and Gamepad all function as expected.
The lack of keyboard support for hover visuals is a deliberate choice, there’s a paragraph here that explains things but the short version is that there’s a lot of room for confusion when you have both the mouse and the keyboard triggering hover visuals simultaneously. When you enable CommonUI we register a preprocessor to drive an invisible virtual cursor, which we reposition over the focused button to trigger it’s hover visual. Since Keyboard & Mouse are a single input method, we assume you have a mouse and we shouldn’t be manipulating a second cursor like that.
That said, there are a couple ways you can work around this to support those same hover visuals via keyboard navigation. This tutorial from the developer community solves it by introducing a separate style for keyboard navigation. If you’d rather make an engine change, you could look at FCommonAnalogCursor::Tick and remove that IsUsingGamepad check so that it continues to update with mouse/keyboard input. You could also manipulate the position of FCommonAnalogCursor yourself if you want to trigger the existing hover states manually when navigating with keyboard.
Its good to hear a reason and suggestion from Epic rather than the speculations of the community.
I might try the postion manipulation of the cursor as i’m trying to make this easily reusuable when thinking of starting new projects while using Vanilla UE5