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
- Default Custom Components in project have Library counterparts
- [iOS]"The destination host has an erroneous SSL certificate" error is thrown when using UnityWebRequest to connect to the server with a self-signed certificate
- Freeze/crash on DynamicHeapAllocator::Allocate when opening a specific project
- Text Settings Inspector sections names have no padding
- UI elements shrinking, misaligned buttons, swapped icons, or incorrect styles when rapidly cycling through Scenes in the Player
HarryCodder
Apr 05, 2022 09:43
Please backport this fix on the LTS branches as well.