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
- Crash on __pthread_kill when initializing Vuplex WebView while entering the Play Mode
- Crash on FindSurface when adding a custom Renderer Feature to a 2D Renderer Data Asset
- [Android] [Vulkan] [UI Toolkit] Application crashes when the device is rotated when it has UI Toolkit TextField on Vulkan devices
- Crash on DualThreadAllocator<DynamicHeapAllocator>::TryDeallocate when opening a specific project
- Crash on memset_repstos when pressing a UI button while in Play Mode
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.