Enable automatically loading mappings.
When a gamepad with a known (to this system) ID is plugged in, this will load the previously saved mapping.
Get a controller mapping.
Note that modifying this mapping in place will modify the target controller.
However, use setMapping to finalize the mapping.
Which controller?
all of the sticks. Convention is 0 = left, 1 = right.
Check if a gamepad button is down.
Returns true for only one frame/update if a button is pressed.
Considered an alternative to like.gamepadpressed.
Set the mapping for a particular controller.
Set save = false if you don't want this written into localstorage.
LIKE Gamepad Wrapper
If you're planning on supporting gamepads, please include a way to generate GamepadMapping and set it with Gamepad.setMapping. Perhaps trigger it on gamepadconnected events.
If you don't want to make your own, take a look at scene/prefab/mapGamepad
When to use gamepad remapping
For games with heavy and varied gamepad use, mapping buttons is essential.
But if your game relies on a small set of logical actions like 'accept' or 'jump', don't hesitate to reach for input in order to map based on actions instead.