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
- Some UXML Template Asset foldouts appear enabled when all fields inside are disabled
- URP Terrain Demo crash on burst_signal_handler after Generating lighting
- Project window button icons are poorly visible and their shades differ in Light theme
- GC.Alloc called by HDRenderPipeline.LensFlareMergeOcclusionDataDrivenPass() when playing the default HDRP Sample Template project
- Automatic LOD fails and SRP Batcher incompatibility occurs when using spline-based quad-topology meshes
Add comment