UMG widget button needs arrow input before focus

So I’m trying to make a menu system that uses the keyboard or gamepad. For the most part, it works, you can highlight a button and select it. My issue is, when I first open the menu, my widget doesn’t get keyboard focus until I press the down arrow on the keyboard. This results in you skipping the first button on the menu, but pressing the up arrow afterwards allows you to highlight and select it.
This is when you first open the menu:

This is after you press the down arrow:

and then when you press up:

I have tried using set InputMode but that just yields the same results. I can’t work out if this is a bug or if this is just down to me not using the functions correctly, the blue print I’m using for my menu widget is below. Any help would be much appriciated

Try calling SetUserFocus and sending the GetPlayerController to that node, after setting keyboard focus in your Construct event.

No good, just gave me the same result.

Try going to Play → Advanced Settings → and make sure the first option (Game Gets Mouse Control) is set to true.

It’s set to true now and coupled with your other suggestion but still no change :confused:

Edit: completely misread, my apologies, thought arrow was ‘mouse arrow’. However, I still think this may yield some assistance towards resolution.

Ah, yes, I had fun trying to figure this one out myself with my inventory system. Took me a while too, but this is what ultimately worked, regardless of how bizarre it may seem haha.

Now I’ve included everything that I use to display and hide my inventory system, so most of this may be unrelated, however, I included it just in case. The main one I think you will need is the first image, the Widget BP Nodes.

Hopefully this helps in some way!

Thanks for your input but unfortunately I’ve been unable to yield any results :frowning: I’ve tried messing around with the is focusable bool but it seems sort of redundant since I already have is focusable ticked in the details panel.

I have this exact same issue, but I can’t seem to solve it.

same here, I have to click in my main menu game before being able to click/hover the buttons

1 Like

I had what I think is a similar issue, where I manually set focus on a widget when opening a pause menu, but pressing the button with gamepad input wouldn’t register, despite the widget definitely being in focus. If I navigated to a different button and then back to the first one it worked, but never on opening the menu.

I solved it by overriding the “OnKeyUp” function in the widget and inserting relevant event/functions on a switch based on the pressed key name. You can also use “OnKeyDown”, but that was causing other issues with my setup.

OKU

1 Like

Just in case this may be useful. Maybe this is what was happening to you guys. In my case, I needed to target the actual button within the widget because I was using a custom widget button inside another menu widget. Targeting the widget button won’t work because it’s actually a “canvas”, you need to target the button inside the canvas instead.

1 Like

Thank you so much been pulling my hair out with this issue and this solved it!

1 Like