- Home /
How to use multiple xbox controllers?
I am trying to make a game for my xbox one. The game would be a 2-4 player fps battle game. The only problem is that I don't know how to get input from more than 1 individual xbox controllers so I am wondering how to do that.
Answer by Stratosome · Sep 05, 2018 at 12:49 AM
Currently, if you were to plug in multiple Xbox controllers into your computer, they would all be using the default inputs in Unity's input manager. So, the Horizontal and Vertical inputs would be for all controllers for example.
If you were to look at those inputs in the input manager list, you would see that their joy num is set to something like "Get Input From All Joysticks". You don't want that (well, it depends). Making multiple inputs, and changing their joy nums to like "Joystick 1", "Joystick 2", and so on will grab the input from that controller. Kinda make sense hopefully? Essentially that joy num variable on the inputs are for multiple controllers.
Ok so I switched my joy nums to different joysticks but controller number one still controls what what the other controllers are supposed to control and vice versa and I'm really confused. Any idea why?
$$anonymous$$anaged to figure it out. Thanks for all your help.
Answer by ShawnFeatherly · Apr 20, 2019 at 07:02 PM
Not only do you need to change "Get Input From All Joysticks" you also need to update the text put in for "Positive Button".
Joystick Buttons (from any joystick): “joystick button 0”, “joystick button 1”, “joystick button 2”, …
Joystick Buttons (from a specific joystick): “joystick 1 button 0”, “joystick 1 button 1”, “joystick 2 button 0”, …
I found this answer on https://answers.unity.com/questions/1322762/multiple-joystick-input-trigger-all-inputs.html which referenced the detail I copied above from https://docs.unity3d.com/Manual/ConventionalGameInput.html