Search Unity

C# Multiple Gamepads! How do I get them to work seperately?

Discussion in 'Scripting' started by From-Soy-Sauce, Sep 1, 2014.

  1. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    Hello, I'm trying to make a fighting game, but when I plug in multiple USB gamepads to my computer, Unity takes the input for both instead of just one of them. How can I make it only the button checking for a specific command only check 1 gamepad?
     
  2. jeThomas

    jeThomas

    Joined:
    Nov 13, 2013
    Posts:
    6
    Hi, I'm fairly new as well.. but I'm pretty sure I know how to solve your problem.

    Firstly open up your input manager in Unity3D.
    Edit>Project Settings>Input.
    Then find your keys, go to the bottom of each list (Joy Num) and instead of "Get Motion from all Joys"; select Joystick 1.
     
  3. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    Thanks for the reply but that doesn't work.

    When it is about a button it remains the same as before.

    When it is about a stick axis, then no controller can affect it.
     
  4. jeThomas

    jeThomas

    Joined:
    Nov 13, 2013
    Posts:
    6
  5. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    I solved the problem:

    The key is that in the input inspector not say "joystick button 1" but to specify "joystick 1 button 1"
     
    jeThomas likes this.
  6. jeThomas

    jeThomas

    Joined:
    Nov 13, 2013
    Posts:
    6
    Hey that is awesome! Great job.