GetSupportedGamepadKeyCodes
For thread safety, this property is not safe to read in an unsynchronized thread.
This function returns an array of Enum/KeyCode|KeyCodes that the gamepad associated with the given Enum/UserInputType supports.
This function can be used to determine which KeyCodes are supported and not supported by a connected gamepad. To determine if a specific KeyCode is supported, use UserInputService/GamepadSupports.
If called on a non existent, or non connected, gamepad, this function will return an empty array.
As UserInputService is client-side only, this function can only be used in a LocalScript.
Check out this article to learn more about adding support for gamepad input into your game and this page for articles on cross-platform development.
See also
UserInputService/GamepadConnectedUserInputService/GamepadDisconnectedUserInputService/GetConnectedGamepadsUserInputService/GetNavigationGamepadsUserInputService/SetNavigationGamepadUserInputService/IsNavigationGamepadUserInputService/IsGamepadButtonDownUserInputService/GetGamepadStateUserInputService/GetGamepadConnectedUserInputService/GamepadSupportsUserInputService/GamepadEnabled
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
|
|
The |
Returns
| Return Type | Summary |
|---|---|
|
An array of |
Code Samples
Binding Supported Gamepad KeyCodes
This example gets a list of navigation gamepads and a list of their supported Enum/KeyCodes. Then, it iterates through the supported KeyCode list and binds the ButtonX and X keys to functions if they are supported by a gamepad using the ContextActionService/BindAction|ContextActionService.
Check out this article to learn more about adding support for gamepad input into your game.