This page specifies the controller bindings for several operating systems using the most commonly acquired drivers for each.
- Windows tested against Windows 8.1 using default drivers
- Mac OS X tested against Mavericks and Yosemite using Tattie Bogle 0.12 controller driver
- Linux tested against Ubuntu 13.04 64-bit using the default driver
Unity will only reference axises via the input manager, while buttons can be accessed via joystickbuttonX or through the KeyCode enum, where X is the number of the button provided in the table below. For example KeyCode.JoystickButton9 would refer to the Right Stick Click on Windows, the Start Button on OS X, and the Left Stick Click on Linux.
|Windows||Mac Os X||Linux|
|Left Stick X Axis||0||0||0|
|Left Stick Y Axis||1||1||1|
|Right Stick X Axis||4||3||4|
|Right Stick Y Axis||5||4||5|
|D-Pad X Axis||6||7||Only Wired Controllers Support D-Pad Buttons on Linux|
|D-Pad Y Axis||7||8|
|Triggers||3||The left trigger is represented by the range -1 to 0, while the right trigger is represented by the range 0 to 1.|
|Left Trigger||9||5||3||Windows supports a 0 to 1 range for both triggers. Mac OS X supports -1 to 1, however the trigger initially starts at 0 until it is first used.|
|Left Stick Click||8||11||9|
|Right Stick Click||9||12||10|
|D-Pad Up||5||13||Only Wireless Controllers Support D-Pad Buttons on Linux|
This page serves as a cross reference between Unity and the XBOX 360 contoller buttons/axis.
Full controller support
If you only build your game for Windows, you may be interested in XInput.NET which allows full XBox 360 controller support.
NOTE: These are the button references for the controller on WINDOWS ONLY. The Mac and Linux layouts below differs slightly from this.
Button sensitivity should be 1000
A = joystick button 0
B = joystick button 1
X = joystick button 2
Y = joystick button 3
LB = joystick button 4
RB = joystick button 5
Back = joystick joystick button 6
Start = joystick button 7
Left Analogue Press = joystick button 8
Right Analogue Press = joystick button 9
Analog Axis sensitivity should be 1, digital should be 1000.
Left Analog Horizontal = X Axis
Left Analog Vertical = Y Axis
Triggers = 3rd Axis (Left: -1 - 0, Right: 0 - 1) _ (Left Trigger Axis: 9th, Right Trigger Axis: 10th (Both axis are 0-1))
Right Analog Horizontal = 4th axis
Right Analog Vertical = 5th axis
D-Pad Horizontal = 6th Axis
D-Pad Vertical = 7th Axis
InputManager.asset file with four XBox 360 controllers mapped: http://www.unifycommunity.com/wiki/images/a/a1/XBox360_Inputs.zip
InputManager.asset file with four XBox 360 controllers mapped w/seperate axis for R/L triggers: http://www.mediafire.com/?mxu0c1dabogq1q6
== MAC OSX XBOX 360 CONTROLLER LAYOUT USING TATTIE BOGLE DRIVER ==
Linux Xbox 360 Controller Layout Using Ubuntu 13.04 with default xpad driver
(Tested on a fresh install of Ubuntu 13.04 64-bit with the default driver. Build tested made with Unity 4.2. Not tested with xboxdrv driver.)
D-Pad mapped as two axis only works for wired Xbox controllers.
For wireless controllers:
-Left is button 11
-Right is button 12
-Up is button 13
-Down is button 14