Search Issue Tracker
Fixed in 0.3.0
Votes
0
Found in [Package]
0.2.0-preview
Issue ID
1133674
Regression
No
[Scripting] When using ReadValue<T> with a mismatched value type, a wrong exception is thrown.
Github bug: https://github.com/Unity-Technologies/InputSystem/issues/361
From forum: https://forum.unity.com/threads/indexoutofrange-on-axis-action.601777/
When using ReadValue<T> on an Input Control, if the <T> does not match the value type, ISX throws IndexOutOfRangeException, which is the wrong exception to use.
The exception should be accurate about the error, and help in identifying the issue. In the case, it should reflect the mismatched variable type (ArgumentException?)
Repro:
1. Download project and package at: https://github.com/Unity-Technologies/InputSystem
2. Open with 18.3 or 19.1
3. Open scene: Demo -> SimpleDemo -> SimpleDemo
4. Open C# script: Demo -> SimpleDemo -> SimpleController_UsingActions_InAsset (the one used on Player gameobject in the scene)
5. In the script, go to Awake() function, and finc "controls.gameplay.move.preformed += ctx => _Move = ctx.ReadValue<Vector2>()"
6. Change the "Vector2" at the end to "Vector3"
7. Enter Playmode and move around with WASD
Actual: IndexOutOfRangeException is thrown
Expected: Some other exception about mismatched variable type is thrown (ArgumentException?)
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Frame Debugger is not disabled when switching Scenes if the Frame Debugger window is not open during the transition
- Standalone Profiler Targets another Project if a Standalone Profiler was launched in it before when switching between Edit or Play Mode Targets
- Crash on ForwardRenderLoopJob when opening a specific project
- [Android] Memory leak and eventual crash on Snapdragon 8 Gen 1+ devices when a Clear Pass is executed after Framebuffer Fetch
- PhysicsRaycaster ray length is incorrect when casting from rotated Camera
Add comment