Search Issue Tracker

By Design

Votes

0

Found in

2021.3.25f1

2022.2.20f1

2023.1.0b17

2023.2.0a15

2023.3.0a3

Issue ID

UUM-35888

Regression

No

The last element of an array is not displayed when using a ListView of elements with a custom PropertyDrawer

--

-

How to reproduce:
1. Open the attached project "UIToolkit Test.zip"
2. Open Test>Open Dialog ...

Expected results: 3 array elements are displayed in the "DisplayDialog" window
Actual results: "InvalidOperationException: The operation is not possible when moved past all properties (Next returned false)" thrown in the Console window and only 2 array elements are displayed

Reproducible with: 2021.3.25f1, 2022.2.20f1, 2023.1.0b17, 2023.2.0a15
Could not test with: 2020.3.48f1 (compilation errors in the Console window)

Reproducible on: Windows 10

  1. Resolution Note:

    The problem lies within the property drawer. A SerializedProperty is already an iterator. Invoking GetEnumerator alters the state of the SerializedProperty, causing it to no longer reference the original property and move on to the next one. To avoid this, it's advisable to create a local copy of the SerializedProperty, leaving the original one unaffected.

    Consider implementing the following approach to mitigate the issue:

    ```Before accessing the iterator, make a local copy of the SerializedProperty using:
    property = property.Copy()```

    This step ensures that the original SerializedProperty remains unaltered during subsequent operations.

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.