Dualshock 4 keeps running and then it never lets me to do anything with Keyboard

Hey, I love this new system. Really a lot. But at this moment, I made 2 control schemes one for ds4 and one for keyboard/mouse. Then I assign left stick (up, down, left, right) and WASD keys for keyboard.

Controller works great, I can set lightbar colors and everything… but the controller keeps on running. When I try to move a character with controller, everything works. When I do the same with keyboard, it debugs right but then due to gamepad running… it never moves my character properly. It gets stuck and stuff.

Here is the code…

private void OnEnable()
    {
        _controls.Enable();
        _controls.Player.Movement.performed += OnMovementInput;
    }
private void OnDisable()
    {
        _controls.Disable();
        _controls.Player.Movement.performed -= OnMovementInput;
    }

private void OnMovementInput(InputAction.CallbackContext ctx)
    {

        MovementInput = ctx.ReadValue<Vector2>();
        Debug.Log(MovementInput);

        if (ctx.control.device is Gamepad)
        {
            var controller = (DualShockGamepad)Gamepad.current;
            if (MovementInput.x < 0)
                controller.SetLightBarColor(Color.red);
            else if (MovementInput.x > 0)
                controller.SetLightBarColor(Color.green);
            else
                controller.SetLightBarColor(Color.blue);
        }
    }

Am I missing something? :confused: I remove my controller and keyboard works great. Also when I stop playmode my ds4 is still lit up.

This has caught many a user off-guard. The problem is that the generated C# classes do not do anything with control schemes out of the box. I.e. ATM only PlayerInput automatically uses control schemes and sets up devices per player.

More detail can be found here .

It’s on the list for after 1.0 to improve the capabilities of the auto-generated C# code and get it en par with what PlayerInput can do.

Oh, that’s the reason. I totally understand that now, thank you really for the help!
Also, I have a small question on invoking csharp events from PlayerInput instead of UnityEvents. We have to do something like,

_playerInput.actions["fire"].performed += OnFire;

Right? wouldn’t that be a lot of manually writing action’s name? Is there any easy way to overcome that?