Xbox Controller Input handling is an interesting topic, while Unity handles the underlying device integration and exposes virtual axes and buttons, it still gets tricky since assignments vary across platforms.
In previous blog entry, I discussed the typical setup values for button and joystick mapping to the Xbox One controller on Windows 10.
Part 11: Using an Xbox One Controller with Unity on Windows 10
One difference to be aware of are axis return values especially with the Left Trigger and Right Trigger Handling.
On Windows, Axis 3, Axis 9 and Axis 10 are associated with the Xbox controller triggers. Axis 3 is the effective sum of Left Trigger and Right Trigger Press (or more appropriate the “Pull”). The Left Trigger results in a 0 to 1 value on Axis 3 while the Right Trigger results in values 0 to -1, when pressed together to its maximum value, it would result in a 0. The functionality seem to apply best for driving simulations where the Triggers are used as Gas or Brake functions or even Left and Right turn movement on tracked vehicles such as Tanks with its proportional values instead of being treated like an ordinary switch on or off.
If you need to access or detect the trigger status independently, Left Trigger maps to Axis 9 while Right Trigger maps to Axis 10 resulting in 0 to 1 values depending how much the trigger is pressed. For shooting games, the developer has the flexibility for determining how much “pull” is required for the trigger to register by defining a threshold value in the 0 to 1 range.
Something to consider when writing multi-platform apps is return values vary across devices and platform. If you pair the same Xbox One S controller to an Android device with my Android mapping blog — the Left and Right Trigger returns a -1 to 1 value with -1 being the base value and 1 when it is fully pulled.
Developing with the Xbox One-S Controller using Bluetooth on Android and Unity