Gamepad Widget is a really simple widget class that makes it easier to create controller compatible user interfaces in Unreal Engine. It eases the switch between using mouse and keyboard to gamepad and allows buttons to behave like they should when using a controller.
This feature is the main reason behind this class. It allows "focused" buttons to be properly displayed as "Hovered" or "Pressed". Focus navigation with a controller is already supported by Unreal Engine. It however doesn't allow for button styles to be applied straight out of the box.
This plugin manages it automatically for the user.
Widget Input Events
This widget class also eases the transition between using a mouse/keyboard to using a gamepad at runtime. It automatically detects which input is being used and allows developers to execute widget specific code when switching input device.
Although no input should be managed from widgets, this allows for custom behavious to be implemented on a per widget basis.
Step 1: Widget creation
First of all, for your widget to inherit the plugin's features you have to make it a child class of the GamepadWidget class. This is done by creating a new blueprint class and looking for the "GamepadWidget" class (see screenshot). If your widget already exists, you can also reparent it by going to its Class Settings and changing its parent class from UserWidget to GamepadWidget.
Step 2: Widget set up
In your newly created widget, look for the EnableGamepadSupport function. You need to input an array of all the button you wish the gamepad to have access to, and the button that should be selected when the menu is spawned. This all the coding that is required for the plugin to work.
Buttons will now automatically change style when a gamepad is used and the widget will automatically detect which input device is being used (gamepad or mouse).
Several functions are available if you want to interact with buttons via blueprints. These require the gamepad support to be enabled (see Step 2) and should work with no issue alongside the plugin's functionalities.
If you want to further customise the way the plugin works feel free to open up the GamepadWidget widget class and modify from there! Everything is commented so you should be able to understand what's happening under the hood!