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
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
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
- Multiple Bug Reporters spawned when crashing from several threads at once
- Editor hangs when cutting and pasting a Script to another folder during Play Mode
- Animator Controller throws MissingReferenceException after undoing Layer Creation
- Full stack trace is always printed when an exception occurs in an IL2CPP build
- Licensing Client fails to launch when opening Unity Hub (licensing client path is not found)
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.