Search Issue Tracker

Active

Under Consideration for 1.5.X

Votes

1

Found in [Package]

1.5.1

Issue ID

ISXB-473

Regression

No

[New Input System] Control modifiers not consumed when used across different action maps

Package: Input System

-

Reproduction steps:
1. Open the attached project "ReproProj"
2. Open the “/Assets/main.unity” Scene
3. Enter the Play Mode
4. Click on Game View
5. Press CTRL + Numpad8
6. Observe the Console window

Expected result: 1 Message appears in the Console window “WITH modifier performed”
Actual result: 2 Messages appear in the Console window “WITH modifier performed” and “WITHOUT modifier performed”

Reproducible with: 1.2.0 (2020.3.47f1), 1.5.1 (2020.3.47f1, 2021.3.25f1, 2022.2.19f1, 2023.1.0b15, 2023.2.0a13)
Could not test with: 1.1.1 (2020.3.47f1) (Assets\PS5EdgeSupport.cs(10,36): error CS0246: The type or namespace name 'DualSenseGamepadHID' could not be found)

Reproducible on: Windows 10 Enterprise 21H2

Notes:

* When input action consumption is enabled, but actions are split across several input action maps, modifiers are not consumed across inputs in different maps
* This may be expected, but it prevents easily using input action maps as layer groupings and also is not documented anywhere I can find, which caused a long and painful debugging process
* 2 commands, "with" and "without" are created programmatically in Controller.cs. One is bound to ctrl+numpad8, and one to numpad8 only
* If you press ctrl+numpad8, you get console messages showing BOTH are pressed
* If both inputs are assigned to the same map (for ex. "map"), it works as expected

Comments (1)

  1. forestrf

    Jul 27, 2023 03:35

    Thank you a lot for the insight about "input consuming" only consuming inputs for InputActions on the same ActionMap. This allowed me to use this feature by moving all inputs to a single ActionMap.

    This is no ideal but it worked for me, I had to change the logic from enabling/disabling different ActionMaps to enabling/disabling the individual actions that were inside it.

    It was still not enough for the use-case of having only shortcuts (buttons with modifiers) consume input, as any type of composite consumes inputs and those who have more composite parts have more priority to consume inputs, which makes 2D directional inputs, with 4 composite parts, the ones with the most priority. To fix this problem I added the virtual function "IsShortcut()" to the class "InputBindingComposite" and then inside ComputeControlGroupingIfNecessary() of InputActionState.cs replaced the code that measures the complexity with:

    ```
    // Compute complexity.
    var complexity = 1;
    if (binding.isPartOfComposite && !disableControlGrouping) {
    var compositeBindingIndex = binding.compositeOrCompositeBindingIndex;

    var bindingComposite = bindingStates[compositeBindingIndex];
    var composite = composites[bindingComposite.compositeOrCompositeBindingIndex];
    if (composite.IsShortcut()) {
    complexity = 2;
    }
    }
    ```

    For some reason I can't comment from Firefox, it keeps going to the login form, I had to use Chrome. Also, once the captcha expires after solving it, the page has to be reloaded to be able to post a comment.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.