Search Issue Tracker
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
- Reproducible if the Inspector window is opened
- Error in Console: "GetElementHeight called with index 0 but array only has 0 element(s).
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)"
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- The script can be dragged and dropped before it is compiled
- Double clicking script field no longer opens it in the external script editor
- [Android] Build fails with built-in PAD custom asset(s) when using sample Addressable
- [iOS] nw_read_request_report crash
- The serialized field value cannot be changed when trying to set it back to "None"