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
- [Android][IL2CPP] Player crashes on __memcpy_aarch64_simd+276 when invoking native code via a plugin on some ARM64 Android devices
- [Android]Resources fail to load when the AAB build contains a large Addressables Bundle
- Unity is loading internal version of SharpZipLib instead of local version
- The Context Menu items are ordered incorrectly
- Audio Mixer does not change volume when lowering volume on an Audio Mixer loaded from AssetBundles
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.