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.
- Performing Android and iOS batch-mode builds causes error in RenderTexture
- Windows Player exe contains unwanted properties, causing text "Unity Playback Engine" to appear in task bar when mousing over it
- Changes made by the Script in the UI Document are reset when performing an Undo operation after changing the GameObject with this Script
- Emissive materials are broken when loading Scene via SceneManager.LoadScene
- [URP] [Decals] ProxyLighting Decal shader doesn't work in Screen Space Technique