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
- Tile Palette grid is moved after entering Play Mode
- Tile Palette Edit mode turns off in Play Mode
- The Editor crashes when Generating Font Atlas in the Font Asset Creator with “9999999999” padding and 256x256 Atlas Resolution
- [iOS] An “ArgumentNullException” error is thrown when GetIntroductoryPriceDictionary() method is called
- Memory leak warnings are constantly thrown when Generating Font Atlas in Font Asset Creator with 4096x8192 Atlas Resolution
Add comment