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
- UI Builder Viewport is rendered in solid black and ArgumentOutOfRangeException is thrown when zooming in
- Game view renders yellow color when using RenderTexture.autoGenerateMips with DX12
- The "Multiplayer Widgets" package is displayed as an option for the installation even though it is already installed
- "IMGUIContainer cannot be used in a panel drawn by cameras." error thrown when adding IMGUI Container in UI Builder > Hierarchy
- Crash on GameObject::RemoveComponentFromGameObjectInternal when opening a specific project
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.