Search Issue Tracker
Fix In Review for 2022.1.X
Votes
1
Found in
2022.1
2022.1.0b2
2022.2
Issue ID
1392262
Regression
No
ArgumentOutOfRangeException error is thrown when element is deleted in the PropertyDrawer ListView
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 _item._properties.Array.data[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'")
Notes:
- If an element wasn't deleted, only the 1st error appears
- Reproducible on both Windows 10 and macOS
Comments (1)
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
- [Android] The Player screen turns black when playing a video under certain conditions
- Search window icons at the bottom are cut off when Search window is resized vertically
- "Try something else?" text label is cut off when searching for a long text in the Search window
- Rendering Debugger window sections do not have a minimum width set when resizing with the slider in the middle of the window
- Last segment of a Sprite Shape Spline is affected by other segments' Sprite Variant change when no edge Sprite is selected
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;
return;
}
....
};
listview.itemsRemoved += e =>
{
removed_idx = e.First();
};