Search Issue Tracker

Fix In Review for 2022.1.X



Found in




Issue ID




ArgumentOutOfRangeException error is thrown when element is deleted in the PropertyDrawer ListView

UI Builder


Reproduction steps:
1. Open the user's project
2. Select "New List View Container.asset" in the Assets folder
3. Press the '+' button in the Properties list to add a new ItemProperty
4. Choose one of the proposed options to add
5. Press the '-' button in the Properties list to remove an ItemProperty

Expected result: The selected element is deleted without any errors
Actual result: The selected element sometimes (about 1/3 times) is not deleted and errors are thrown: \
1st error - "ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection."
2nd error - "SerializedProperty[X] has disappeared! UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)"

Reproducible with: 2022.1.0b11, 2022.2.0a7
Could not test with: 2019.4.36f1, 2020.3.30f1, 2021.2.15f1(2019.4, 2020.3 - "Assets/Scripts/Editor/CustomControl/CustomDropDown.cs(30,37): error CS8124: Tuple must contain at least two elements."; 2021.2 - "Assets/Scripts/Editor/ListViewExample/InventoryItemPropertyDrawer.cs(123,51): error CS1061: 'SerializedProperty' does not contain a definition for 'boxedValue' and no accessible extension method 'boxedValue' accepting a first argument of type 'SerializedProperty'")

- If an element wasn't deleted, only the 1st error appears
- Reproducible on both Windows 10 and macOS

Comments (1)

  1. maximilianahead

    Apr 05, 2022 17:38

    2nd error is 100% occured on my project.(version 2021.2.13f )
    Called from UnityEditor.RetainedMode:UpdateSchedulers () will be used the changed list, no problem.
    However, the one called from UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) uses the unchanged list and an error occurs.
    Workaround at me:

    int removed_idx = -1;
    listview.bindItem = (VisualElement element, int index) =>
    if (removed_idx == index)
    removed_idx = -1;
    listview.itemsRemoved += e =>
    removed_idx = e.First();

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.