ButtonPosition vs Button
Last updated
Last updated
ButtonPosition can be used to reference a button based in its physical position rather than by letter. Referencing a button by position can be useful if players are playing your game with gamepads which do not necessarily position their buttons identically.
For example, consider the A, B, X, and Y button positions on the Xbox and Switch controllers.
You may want your game to use the button positions rather than specific button letters when assigning input to your player.
Entities typically use IPressableInput instances to control actions like jumping. Rather than inspecting the gamepad type, games cna use the ButtonPosition to assign input. For example, the following code might be used to assign the JumpInput: