New Input System and Modifiers

I am using the new input system with my app that is a chess gui. As such it uses the keyboard arrows in 3 different ways:

  • rotate the camera (with control key)
  • move in the game list (with shift key)
  • outline/select/move a piece on the board (with no modifiers)

The original problem is that there is no “key with no modifiers” option in the new input system, so I am forced to create Modifier entries such as shift and control and then change state accordingly.

That works but the gamepad does not need such modifiers: there are 2 sticks + 4 directions button so it can do everything without modifiers.

So if I bind rotating the camera to right stick, how can I rotate it without pressing the control key (or an equivalent button on the gamepad)?

I have tried like this but it wont work:

I can try to get rid of one modifier and bind one to WASD and the other to arrow keys, but I have 3 uses for the arrows and also I don’t think it’s a great idea because some laptops have a very limited keyboard.

I sort of solved the issue by removing the Modifiers and adding this to the code:

        var shift = Keyboard.current.shiftKey.isPressed;
        if (shift)
        {
            return;
        }

The only problem left was that the 1D axis does not support modifiers so for the sake of simplicity I bound the arrows without modifier to the camera and ctrl+arrows to piece selection.

That’s not ideal but it works, I hope the Input System will have a better handling of modifiers in the future:

  • the ability to create binding for a key with no modifiers allowed
  • the ability to specify modifiers for the 1D axis
1 Like

I was looking for the same thing, and the only solution I found was to write a custom composite, which seems a bit too much for a standard functionality (I also think of things like character walking / character running when a button is pressed): https://docs.unity3d.com/Packages/com.unity.inputsystem@1.4/manual/ActionBindings.html#writing-custom-composites