How to navigate with a gamepad on Input Key Selector

Hi everyone,

I’ve finished my menus and they work perfectly fine with a mouse and a keyboard. Now I’m trying to implement Gamepad navigation but I’ve found myself stuck with Input Key Selector.

Most of my menus are Buttons, so when I’m using a gamepad to navigate I simply check at the tick which button has the Keyboard Focus to change its color. So far this was working perfectly fine, enven tough it might not be the best system. But for my input settings menu that doesn’t contains just Buttons but also Input Key Selector this is not working at all.

I wanted to check at the tick in this menu which Input Key Selector has the Keyboard Focus so I can change its Tint Color but it doesn’t seems to be possible. I’ve tried to change it directly or to use the FButtonStyle::SetNormal function but I can’t compile.

Here’s my code that I try to do in the tick if the Input Key Selector has the Keyboard Focus. I try to apply the color of its Hovered state.

if (UInputKeySelector* InputKeySelector = Cast<UInputKeySelector>(InWidget))
{
    FSlateBrush HoverSlate = InputKeySelector->WidgetStyle.Hovered;
    InputKeySelector->GetButtonStyle().SetNormal(HoverSlate);
}

And here’s the error message that I have :
error C2662: 'FButtonStyle &FButtonStyle::SetNormal(const FSlateBrush &)': cannot convert 'this' pointer from 'const FButtonStyle' to 'FButtonStyle &'

I know I’m missing something here but I can’t figure what it is.
Can someone please tell me what I’m doing wrong ?

Thank you for your time.

Hey, I was having similar issues (made a post linked below) and was wondering if you ever found a solution to this issue.

Hi, sorry I haven’t saw your response earlier.

Unfortunatly no, I switched to using Common UI on my project but I never had time to finished it so my menus are still broken

Ah, I see. Yeah I too ended up just making a custom input key selector out of a common UI button. Still a few quirks with mapping gamepad keys there tho. For example it reads gamepad face button bottom as a mouse button. And if you set it to not simulate mouse input, it will only allow you to press the top button in the hierarchy (like if its in a vertical box for example).

But I figure it’s just a matter of overriding some CommonUIActionRouter functionality, so I’ll let you know if I figure something out there as well.

1 Like

I’ll have to get back to this project in september so likewise. I’ll let you know if I found something.