360 Controller for Unity3D (controller index ? )

This problem isn't concerning how to get Xbox 360 controllers working in Unity, its more about player indexing. As of right now, our game is a 4 player cooperative platformer and we need to have players assigned to specific controllers, so we use a playerIndex variable which is just set on the player prefabs. In the code it is hooked up to get input from certain handles (from the input manager) and they are named like Horizontal1 Vertical1 (for player 1) and for some reason Unity seems to assign random indexes to the inputs and the one that should be reading for controller 3 is reading for controller 1 and vice-versa. Let me know if I'm not clear enough.

1 Answer

1

You could make an user input configuration screen before the start of your game where the user has to press a button to assign his joystick as his input device. (Input.GetJoystickNames)

Well, yes, that makes sense and I probably would have ended up doing something like that anyway but yeah I suppose that's the easiest way to do it. Thanks. But also, if anyone does know how Unity indexes controllers I feel like that would be useful information to tag onto here.