Gamepad/Keyboard navigation in UMG menus?


I’m trying to use UMG for my game menus but my game is suposed to be used with gamepad and I don’t know how to bind the keyboard/Gamepad buttons to move along the menus.

In the 4.6 release it is suposed that we can do it:


You can now navigate between UI elements using a joystick!

By default you can use the arrow keys, directional pad or left joystick to navigate. You can still use Tab or Shift+Tab as well. This works with both Slate and Unreal Motion Graphics.
We’ve unified the concept of “Keyboard Focus” and “Controller Focus” into “User Focus”. Changing user focus will affect all controllers and keyboards for that user.

Am I missing something?

Can someone make a little tutorial on how to achieve this?

I’ve tried to search documentation about this but i didn’t find anything useful for me.

I too am interested in this information. For now I handle all the states manually, and when a controller/keyboard direction is hit the player controller fires an event on the widget that will check which option you currently have selected, and which one should be selected next. It’s not ideal for sure. Then I have to handle the hover/pressed states of the button manually.

I also am interested in this information… Really would like to know what is needed to do this

Me too… in what case does this actually work?

The closest I’ve been able to get this is by putting a bunch of buttons into a vertical container and then when you click anywhere inside the container you can then cycle through the buttons on your controller. It’s a bit impractical but it’s the closest I’ve got to get it working. I’m also interested in working out how to get it working without having to do clicks.

I also am trying this, I think its not really implemented properly yet so far,

What I do is in c++ grab the widget I want TakeWidget() and then use SlateOperations.SetUserFocus() to set the focus to that widget, this lets me use my gamepad, although I have no idea how to change the visuals of that dashed edge you get.
My guess is we have to either learn Slate or wait for better support for UWidgets

I ended up doing it all manually in c++. I keep a navigation ring of button pointers and manually set the ‘hover’ state of all my buttons (at the slate level) depending on the gamepad input events.

It works perfectly with gamepad and mouse/keyboard, but of course it would be awesome if the built-in navigation system actually worked!

Hi cgrebeld, I am trying to do the exact same thing, any chance of sharing your solution?

Hi Cgrebeld, so did you bind some function to “W”(some key) with function and in the function you invoke like “OnClicked” event of UMG Widget’s button? How would I get pointer to a button of the UMG widget in code?

Could you provide simple work flow of code?

I am looking for the same thing… does anyone have solution?


Update: this works with a gamepad as well (tested with an Xbox controller)

I can navigate with keyboard up/down keys using this setup:

Level/character blueprint:

in UMG widget (optional, if you want to customize appearance):

The result (it would be nice if we could change the default “dotted line” focused look):

1 Like

Not working for me, I have placed my buttons in ‘Horizontal Grid’ and have added different images for Normal, Hovered and Clicked state under Style section. Even unchecked ‘Is Focusable’ under interaction section.
Further I tried checking ‘Has Keyboard Focus’ which always returns ‘False’. I am not able to have keyboard focused on the button, any assistance please.

I’ve uploaded a sample project: Cahoots — Ann Arbor tech coworking

Hey thanks for the sample project, downloading started :slight_smile:
Yes got it working. :slight_smile:

So basically there’s no such thing as “You can now navigate between UI elements using a joystick!” am I right?

I’ve just tried my sample project with an Xbox controller - you can both navigate and press buttons. You can download it from the link above and check for yourself.

Thank you, this helped me also.

What did you do to get it working? I’m at the same problem as you had before.

Nvm, one of my wire was mixed up.

To remove the dotted line you can create a class derived from “UGameViewportClient”, then you put that class in your DefaultEngine.ini, below [/Script/Engine.Engine] you must add this line “GameViewportClientClassName=/Script/YourGame.YourGameViewportClient”.
In that class you must overwrite the function

virtual void EnableShowCursor(bool canShowCursor);

to always return false.

With this, the dotted line should not appear