Using the WASD keys prevents gamepad input.

I have a vehicle that can be moved by either the WASD keys, the arrow keys, or the left joystick on a gamepad, all of which are mapped to an action called Move in the new input system. I want to give the player the ability to switch between using keyboard and gamepad input during gameplay.

My vehicle movement script works as follows. In LateUpdate, I execute Turn(controls.Game.Move.ReadValue<Vector2>().x); and Drive(controls.Game.Move.ReadValue<Vector2>().y);.

Here is the Turn function:

void Turn(float direction)
{
    if (direction != 0)
    {
        rb.angularVelocity = turningSpeed * -direction;
    }
}

Here is the Drive function:

void Drive(float direction)
{
    if (direction != 0)
    {
        rb.velocity = transform.up * movementSpeed * direction;
    }
}

When I press play, the left joystick works perfectly. However, the WASD keys, arrow keys, and left joystick on the gamepad seem to interfere with each other. For example, if I move the vehicle with the joystick, then use the WASD keys, the joystick input stops working. Any ideas on fixing this? I’m really confused.

I’m using Unity 2019.2.0f1 with Input System 0.9.0 and a Xbox One controller.

Thanks in advance!

Could you give this a try with 0.9.1? (due out today)

We had a regression in 0.9.0 that made composites not work correctly in combination with the control “disambiguation” code. Meaning, that the code behind actions that is supposed to figure out which input to let through when multiple controls are concurrently bound to a single action wasn’t working right with composites and the end result would be that input was just getting stuck. Should be fixed now.

1 Like

Okay, thanks! I’ll give it a shot with 0.9.1.