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
- [iOS] Back Triple Camera is not focusing manually and automatically
- Mouse inputs cannot be inputted when searching the Shortcuts Menu by type "Shortcut"
- "Debug Assertion Failed!" error when launching Windows Dedicated Server Player with Script Debugging enabled
- [Cinematic Studio][3D HDRP] Shader warnings thrown in the Console window when creating a new project with Cinematic Studio template
- Autoplay is triggered on Audio Assets when changing Asset Bundle tags
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.