Common UI - Gamepad Devices on PC

Hello!

We would like to use UCommonActionWidget on PC for multiple different gamepad devices.

We can set up custom data (as a subclass of UCommonInputBaseControllerData) but the only Gamepad Name available for that data is Generic - it appears that the available gamepad names are dependent on target platforms.

Ideally, we would be able to set the Gamepad Name in the controller data, and then call UCommonInputSubsystem::SetGamepadInputType() to trigger changing all UCommonActionWidgets over to match the corresponding gamepad.

Is there a way of achieving this without adding target platforms?

Thank you for your help.

Hello, something that I can answer.

If you navigate to your UCommonInputBaseControllerData BP classes for consoles, you can set the “GamepadHardwareIdMapping” property in there, if you set it like this, it will switch to that specific common input base controller data based on what gamepad you are controlling:

CommonInputBaseControlerData for PS5:

Input Device Name: FWinDualShock

Hardware Device Identifier: DualSense

CommonInputBaseControlerData for Xbox:

Input Device Name: XInputInterface

Hardware Device Identifier: XInputController

Also, make sure that you actually added all of these custom controller data classes in “Windows” section of CommonInputSettings in project settings.

Hi,

Thanks for answering, this is spot on. The GamepadName dropdown is populated automatically based on available platforms since we know you’ll likely need to create controller data for those platforms, but we’ll use the hardware device info to match up controllers for auto-switching icons. If naming collisions are an issue and you want to avoid multiple “Generic” entries, you could subclass UCommonInputBaseControllerData in C++ to assign your own gamepad name.

Best,

Cody

Thank you both for the information - that’s very useful!

I’ll give this a try and reply with the results.

I tested modifying UCommonInputBaseControllerData to support additional Gamepad Names and that worked nicely. It is now possible to create a blueprint derived from UCommonInputBaseControllerData and access all Gamepad Names in the dropdown.

Calling UCommonInputSubsystem::SetGamepadInputType() with the desired Gamepad Name also triggered changing all UCommonActionWidgets over successfully.

The one detail that eludes me is how to to determine the Input Device Name and Hardware Device Identifier for additional gamepad devices on PC, for example “Switch Pro Controller” - what is the best way to do this?

Hi,

You can use the console command Input.ListAllHardwareDevices to see the currently registered device names and hardware identifiers, so if you have a gamepad being properly recognized in the editor then it should show up in that list. If you’re running into issues pairing up with any particular gamepad, I’d recommend posting a new ticket in the appropriate platform group (and referencing this ticket) so we can give more specific advice.

Best,

Cody

That’s great - thank you for answering all of my questions!