Gamepad / Joystick not working (latest unity input system)

Hello,

can anybody give me a hint why Cursor and WASD keys are working great for me but joystick / gamepad does not? Gamepad is detected by Windows (10). Unity is 2022.14.

Local multiplayer game.

My EventSystem gameobject in the game scene looks like this:

My code for moving looks like this. WASD and Cursor keys work perfect. the gamepad move is never been called:

    public void OnMoveWASD(InputValue value)
    {
        if (GameManager.Instance.State == GameManager.States.Map)
        {
            Navigator.Instance.Move(value);
        }
        if (GameManager.Instance.State == GameManager.States.Game)
        {
            if (Globals.Players[0].InputIndex == 1 || Globals.Players.Count == 1)
            {
                P1Control.Move(value);
            }
            else if (Globals.Players.Count > 1)
            {
                P2Control.Move(value);
            }
        }
    }

    public void OnMoveCursor(InputValue value)
    {
        if (GameManager.Instance.State == GameManager.States.Map)
        {
            Navigator.Instance.Move(value);
            return;
        }
        if (GameManager.Instance.State == GameManager.States.Game)
        {
            if (Globals.Players[0].InputIndex == 0 || Globals.Players.Count == 1)
            {
                P1Control.Move(value);
            }
            else if (Globals.Players.Count > 1)
            {
                P2Control.Move(value);
            }
        }
    }

    public void OnMoveGamepad1(InputValue value)
    {
        if (GameManager.Instance.State == GameManager.States.Map)
        {
            Navigator.Instance.Move(value);
        }
        if (Globals.Players[0].InputIndex == 2 || Globals.Players.Count == 1)
        {
            P1Control.Move(value);
        }
        else if (Globals.Players.Count > 1)
        {
            P2Control.Move(value);
        }
    }

    public void OnMoveGamepad2(InputValue value)
    {
        if (Globals.Players[0].InputIndex == 3 || Globals.Players.Count == 1)
        {
            P1Control.Move(value);
        }
        else if (Globals.Players.Count > 1)
        {
            P2Control.Move(value);
        }
    }

the linked input action looks like this:

Can anybody tell me why my gamepad / joystick does not work at all but cursor keys / wasd are working fine?

Thanks a lot!

It seems setting “Auto-Switch” helps.In the Player Input script see first screen.

But how does it work for 2 players having a gamepad each?

I have the same problem. Unity 2020.2.5.
Before upgrading from 2021 controller was working.

I’m having a similar problem. Input from the keyboard is working fine. Gamepad works fine for UI. Will not work for player input at all.

Player Input clearly indicates that it will call the OnMove and OnFire functions. And it clearly does when the keyboard bindings are used.

Turning on the “Auto-Switch” toggle, as suggested above, breaks all bindings (gamepad and keyboard for player Input AND UI).

I’ve run out of avenues to go down where this could be configure improperly but who knows. Does anyone have a clue why this isn’t working as expected?

Did you try input debug->options->add devices not listed in ‘supported devices’

I just had this problem and I fix it by disabling the other “Player Input” components in the scene. Now my character can switch between the mouse and the controller without any problem.
9758850--1397571--upload_2024-4-9_10-23-45.png

If you have more than one “Player Input” in your scene, you must use the component “Player Input Manager”

9758850--1397571--upload_2024-4-9_10-23-45.png
9758850--1397571--upload_2024-4-9_10-23-45.png

1 Like