Removing Joystick Controls

I need to remove the default ability of receiving input from All Joysticks. As seen here: http://unity3d.com/support/documentation/Components/class-InputManager.html. I do not see an option similar to "Do not get motion from joysticks".

(Local Multiplayer) I'd like to have a control scheme for the keyboard, and another player use an xbox controller. However, I cannot remove player 1's ability to accept input from the controller.

a simple workaround would be to set the input scripts of player two as different inputs in the input manager, and don't configure joystick buttons or axis for it. An easy way to do this woud be to check the player to see if it's the player 2 and run the Walk2 instead of Walk.

The “Do not get motion from joysticks” option you’re looking for is called “Joy Num”.

To make your inputs work for multiple users, name your inputs after the player and always use numbered joysticks:

  • Axes: Create “P1_Horizontal” and select “Joystick 1” from the “Joy Num” dropdown.
  • Button: Create “P1_Jump” use “joystick 1 button 1”.
  • Duplicate these for P2 and use “joystick 2”

In your player controller, add a public variable for the prefix (“P1_”) and when calling GetAxes, prepend that prefix:

public string playerPrefix = "P1_";

...
{
    bool is_jump = Input.GetButtonDown(playerPrefix + "Jump");
    ...
}

(If you’re worried about the performance impact of string concatenation, define public variables for all of your inputs so you can pass them directly into GetButtonDown.)

When you add players to your scene, make sure you update their playerPrefix variable.

Following this pattern will allow you to keep your player controller code the same for two or more players. It should allow players to map different controls on each joystick or on the keyboard.

I got the joystick button names from here