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
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)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Graph VFX not compiling enterely until they are open on MACOS
- Longer component titles exceed the window's display boundaries
- Overlapping objects do not collide when setting Physics.IgnoreCollision to false
- Crash on RaiseException when deleting animation transitions in a specific Animation Controller
- [XR][Vulkan] Vulkan Command Buffer memory leak every frame after scene change when using Multiview Rendering
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.