Search Issue Tracker

Active

Under Consideration for 1.12.X

Votes

1

Found in [Package]

1.12.0

Issue ID

ISXB-1367

Regression

No

Error "Should Not Get Here" when pressing movement input keys after changing enabling / disabling input action maps with auto-generated C# class

Package: Input System

-

Reproduction steps:
1. Open the attached project "ReproProj"
2. Open the “/Assets/_Project/Scenes/Demo Scene.unity” Scene
3. Enter the Play Mode
4. Hold the “Spacebar“ key for 1 second
5. Hold the “Spacebar“ key again for 1 second
6. Use “W”, “A” and “D“ keys
7. Observe the Console

Expected result: No Errors exist
Actual result: Error “Should not get here“ is present

Reproducible with: 1.11.0 (2022.3.56f1), 1.12.0 (2022.3.56f1, 6000.0.35f1, 6000.1.0b3)

Reproducible on:
Play mode

Testing environment: Windows 10 Enterprise 21H2
Not reproducible on: No other environment tested

Notes:
- Does not reproduce with “S“ key
- Error sometimes pauses the Play Mode

Comments (1)

  1. SacredSticks

    Jan 25, 2025 00:49

    If I turn the InputActions auto-generated class into a singleton by adding the following block of code to it, and then referencing it via the instance instead of making a different copy of the class for each action map scriptable object (which was my previous implementation) it fixes the issue.

    public static InputActions Instance
    {
    get
    {
    if (instance == null)
    instance = new InputActions();
    return instance;
    }
    }
    private static InputActions instance;

    I'd suggest adding a singleton aspect to the class, or some variation on it to make this easier. I could of course have my own class specifically to store this seeing as it could be more closely related to my implementation, but I feel like having it function as a singleton would be beneficial overall.

    Long story short, the problem was that each action map was referring to a separate copy of the InputActions class, but by having them each refer to a single instance this problem is solved.

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.