- Home /
How do you set up a 2nd joystick controller?
I looked for this on google and tried looking at the asset store input managers. I couldn't find what I need. I have 2 tanks and wanted 2 people to control them. Tank 1 is already set, so how do I set up tank 2? On windows I plug in a Logitech joystick and wanted to put in another (USB). It's that simple. Thanks.
Answer by Lunatix · Dec 06, 2014 at 11:25 AM
You need to configure a second control set (Player1Vertical, Player2Vertical, ...). Player 1 uses "Input.GetAxis("Player1Vertical") and player 2 uses "Input.GetAxis("Player2Vertical") (and so on).
For joystick axes, choose "Type: Joystick Axis", "Axis: X/Y..", "Joy Num: Joystick 1,2,..". For joystick buttons, choose "Type: Key or Mouse Button" and format your input definition like this: Positive Button: "joystick 1 button 0", "joystick 2 button 0"...
Answer by ThatOneGuy359 · Sep 24, 2017 at 07:15 PM
yes but looking into it i cant seem to find how the (heck) you are supposed to get the second joystick input to work joystick 1 works but for my horizontal/vertical look (that should be done by the second joystick) but when i input joystick 2 my logitech 310 game pad, unity seems keen on only accepting inputs from joystick 1 (the left joystick) while joystick 2 seems to be lacking any input.
Answer by bdilloughery_mvla · Mar 09, 2020 at 05:50 PM
I also tried this, and for some reason only the first joystick is being detected on any given controller. I have set the fields to specifically look at "Joystick Axis", "X Axis" and "Joystick 2" ...
Any USB controller (have tried multiple) that I plug in, Unity only detects the left joystick as either Joystick #1 or Joystick #2. The X and Y both get detected fine by no 2nd joystick is detected at all. I've tried 4 different controllers. No matter what I try, only one joystick ever gets read from a single controller.
------EDIT----- Fixed this. Instead of going to Joystick #1 X axis, then Joystick #1 Y axis, then Joystick #2 X Axis ... The second joystick is still on "Joystick #1", as that is which controller you have plugged in. Instead of X Axis or Y Axis, it is the 3rd and 4th Axis that you need to use. Works perfectly.