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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
Add comment