Search Issue Tracker
Duplicate
Votes
7
Found in
2020.3.31f1
2020.3.32f1
2021.2.15f1
2021.3
Issue ID
1414987
Regression
Yes
Error "GetElementHeight called with index 0 but array only has 0 element(s)." when list has no element
How to reproduce:
1. Open the user's attached project "EmptyReorderableListBug.zip"
2. Open the Inspector window
3. Select the "Some Scriptable Object" asset in "Assets" > "Data" folder
4. Observe the Console window
Expected result: No error occurs
Actual result: Error "GetElementHeight called with index 0 but array only has 0 element(s)." occurs
Reproducible with: 2020.3.31f1, 2020.3.32f1, 2021.2.15f1, 2021.2.17f1, 2021.3.0f1
Not reproducible with: 2019.4.37f1, 2020.3.30f1, 2021.2.14f1, 2022.1.0b14, 2022.2.0a9
Notes:
- Reproducible if the Inspector window is opened
- Error in Console: "GetElementHeight called with index 0 but array only has 0 element(s).
UnityEngine.Debug:LogError (object)
SomeScriptableObjectEditor:GetElementHeight (int) (at Assets/Scripts/Editor/SomeScriptableObjectEditor.cs:28)
UnityEditorInternal.ReorderableList:CacheIfNeeded () (at /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:548)
UnityEditorInternal.ReorderableList:GetListElementHeight () (at /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:740)
UnityEditorInternal.ReorderableList:GetListElementHeight () (at /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:751)
UnityEditorInternal.ReorderableList:DoLayoutList () (at /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/ReorderableList.cs:693)
SomeScriptableObjectEditor:OnInspectorGUI () (at Assets/Scripts/Editor/SomeScriptableObjectEditor.cs:36)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)"
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
HarryCodder
Apr 05, 2022 09:43
Please backport this fix on the LTS branches as well.