Search Issue Tracker
Fixed in 2021.2.X
Votes
0
Found in
2018.4
2019.4
2020.3
2020.3.3f1
2021.1
2021.2
Issue ID
1333052
Regression
No
Value set to serialized fields in OnValidate() method doesn't get displayed correctly in the Inspector window
Reproduction steps:
1. Open user's project "Prefab test.zip"
2. Select "Master Variant" Prefab in Assets/Prefabs
3. Enter Prefab editing mode by clicking on the "Open Prefab" button in the Inspector window
4. Change the "Test Bool" field of the "Class B" component by clicking on the check box next to it
5. Press Ctrl-S to save the changes
6. Notice that console message gets printed out with the value of serialized field ClassB.testBool
7. Leave the Prefab editing mode by clicking on "Master Variant" Prefab in Assets/Prefabs once again
Expected result: After restoring the "Test Bool" value on the OnValidate method after saving, the Inspector should show the check box checked
Actual result: After restoring the "Test Bool" value on the OnValidate method after saving, the inspector shows the box un-checked, until exiting Prefab editing mode
Reproducible with: 2018.4.35f1, 2019.4.26f1, 2020.3.8f1, 2021.1.7f1, 2021.2.0a16
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
- Search field in UI Builder's Library has no character limit
- Changing the value in UI Builder by dragging increases it by a few thousand points when reaching the borders of the screen
- ARM64 architecture DLL incorrectly copied instead of x64 when building for Windows x64
- Crash on TypeTreeIterator::GetNode when opening a specific folder
- Crash on WriteSerializedAssetsV2 when (re)entering the Play Mode in a specific project when IEnumerator Start() is used
Resolution Note (fix version 2021.2):
Updated docs to reflect that we do not support that a script sets values on other scripts during OnValidate as we cannot guarantee UI stays updated to reflect the values being updated in the prefab.