Let’s say we use the Mouse Scroll for camera zoom, but when hold C button, Mouse Scroll changes camera altitude instead. But right now it gives input to both of them, the zoom and altitude at the same time. How can I block the original action of camera zoom from triggering when C is pressed?
*Please note that this example is arbitrary and only used to demonstrate the issue I’m facing. What I need is a procedural solution for my custom InputBindingComposite type I’m using and NOT looking for answers like “Just handle it in camera script”.
After quick testing, this seems to be a problem with Unity’s One Modifier composites as well. Assigning two inputs, one with B key and other Shift + B and pressing Shift + B triggers both of them. Isn’t really there an option to block the B key press when used with modifier?
By default you would need to handle this in your code handling the response to the input as the individual binding detecting B does not check that Shift if not pressed.
That said you can enable the Enable Input Consumption setting which should give you the result you want (assuming both bindings are in the same action map)
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.11/api/UnityEngine.InputSystem.InputSettings.html#UnityEngine_InputSystem_InputSettings_shortcutKeysConsumeInput
1 Like