Search Issue Tracker

By Design

Votes

0

Found in

2019.4

2019.4.31f1

2020.3

2021.1

2021.2

2022.1

Issue ID

1372744

Regression

No

Editor Change Check does not detect change when adding a GameObject into a serialized field

Serialization

-

How to reproduce:
1. Open the attached project "ChangeCheckBug.zip"
2. Open "SampleScene"
3. Select "SelectGameObject"
4. Place a GameObject inside an "Element [x]" field on the "Foo" Component

Expected result: The GameObject is serialized into the field
Actual result: The GameObject is not serialized into the field

Reproducible with: 2019.4.32f1, 2020.3.22f1, 2021.1.28f1, 2021.2.2f1, 2022.1.0a15

  1. Resolution Note:

    The implementation of ChangeCheckScope.changed will automatically call EndChangeCheck(), so it cannot be reused after that to detect changes later on in the loop. As mentioned in the bug description the code can work properly by only checking once, e.g. outside the loop. Another alternative would be to move the using statement inside the loop. There is also a SerializedObject.hasModifiedProperties property that might be helpful.

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.