I’m attempting to add Gamepad support to my game and have 4 xbox360 wireless controllers connected to my PC.
I’m using 1 input axis to listen to all joysticks for button 0 (A - Green button on xbox controllers).
Controller #1 (marked by green ring indicator) returns from Unity (4.2.1f4) that it is mapped to Joystick2Button0.
Controller #2 (also marked by the green ring) returns from Unity that it is mapped to Joystick1Button0.
Controller #3 (also marked by the green ring) returns Joystick3Button0… ← This is correct.
Controller #4 (also marked by the green ring) returns Joystick4Button0… ← This is correct.
Any idea why the first and second gamepad are mixed. I’ve tried the following debug steps so far:
- Restart unity.
- Disconnect and re-sync all controllers in desired order.
- Disconnect and try just 1 controller – Still says Joystick2Button0
- Restart computer and retry steps 1-3.
Is this a controller issue or a Unity input issue.
Here is the debugging code i used:
#pragma strict
function Update () {
if(Input.GetKey(KeyCode.Joystick1Button0)){
print("One");
} else if(Input.GetKey(KeyCode.Joystick2Button0)){
print("Two");
} else if(Input.GetKey(KeyCode.Joystick3Button0)){
print("Three");
} else if(Input.GetKey(KeyCode.Joystick4Button0)){
print("Four");
}
}
System specs:
Windows 7
Unity 4.2.1f4
4 wireless Microsoft Xbox360 controllers
1 Microsoft brand wireless reciever