How to focus on a button without using cursor

I already make a pause menu and I control with my mouse. However, I want it to be used with a Xbox 360 controller : using Joystick/ D-pad to move up/down. However, I’ve not any idea how to do this,I want to deal with it by Using C++,
I found function ,FSlateApplication::SetUserFocus 、FSlateApplication::SetUserFocusToGameViewport…but I don’t
know how to use it,


If you have a widget blueprint asset in your project, then the easiest solution would be to select each button and scroll to the Navigation section of the details tab. Here you can specify the behavior when you use the arrow keys or other input to switch focus from one widget component to another based on direction. If you would like to do this in code, I would recommend looking at the documentation for FNavigationReply which handles this behavior on the code side (FNavigationReply | Unreal Engine Documentation ).


Doug Wilson

I have seen that each UMG widget has a section labelled navigation with some options that appear to be bound to what look like input events (left, right, next, previous) but I cannot find any documentation on how this system works or any functions that reference these. It is possible I just haven’t been looking in the right place.

The events do indeed respond to input. Up/Down/Left/Right correspond to the keyboard arrow keys and controller left thumbstick (if connected/setup) by default. Next and Previous are bound to Tab and Shift+Tab, respectively. If you set the dropdown to Explicit, you can choose which button the given input will direct you to when pressed. The link above indicates how these inputs function in code.

Thanks for you answer! But I Still have some confused. The first is how can I prevent the user to use the TAB key or the left stick to focus specific widgets if I just want to use the DPad. Another question is how can I modify the visual of the dotted line shown after you focus on a widget.