Multiple Xbox 360 Controllers in Unity

I’m having issues with the input for multiple controllers.
At the moment, I have modified the Lerpz 2d platform demo so that it has 2 players running around. I have also modified the PlatformController script for the second character so that it accepts different input from the input manager.

In the input manager, I’ve added a few more actions (Horizontal2, Jump2) as actions for the second player.

Whilst I don’t have any issues with character movement using the analogue sticks - left stick on one character makes the first character move and the left stick on the other controller makes the other character move, the issue comes from pressing a button to make the players jump.

I’ve set it that the A button on the controller makes the player jump (joystick button 0) for both ‘Jump’ and ‘Jump2’ in the input manager. Also change the joy num to 1 for ‘jump’ and 2 for ‘jump2’. However for some reason, both characters jump whenever I press the A button or either controller.

Anyone know a solution to this?

1 Like

I had the same problem some weeks ago, took me a while to figure it out:

Actually, the joystick specified in Joy num doesn’t matter for buttons - what matters is the Positive button entry:
Try replacing the entry “joystick button 0” by “joystick 1 button 0” respectively “joystick 2 button 0”.

2 Likes

Words cannot describe how much you have helped me today!

1 Like

Where does it allow you to specify joystick 1 button 0?

Where does it allow you to specify joystick 1 button 0? I don’t see it listed in the input manager.

In my situation, both gamepad one and two register both gamepad movements

I believe you type it into the “positive button” or “alt positive button” field for each one…
see:

MAN YOU SAFED MY FREAKING LIFE XDDDDDDDDDDDD I Was looking for this solution like for 2 months.

Personally I prefer a third party solution like Rewired to handle this type of problem and much more.

Rewired supports a huge number of controllers out of the box. See the full list of supported controllers. Rewired Documentation | Supported Controllers

I love you Steven! I will always follow in your footsteps.

I found you on discussion boards lol. This seems to be plaguing me!