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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
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.