Search Issue Tracker
By Design
Votes
1
Found in
2018.3.6f1
Issue ID
1129424
Regression
No
Script property value should be added to prefab instance overrides in the scene when default value changed in the script
Steps:
1. Open attached project
2. Load TestScene
3. Open TestScript
4. Add some new property with default value (e.g. public float defaultValue = 3.0f;)
==>
DefaultValue has 3.0f value in the Inspector for both prefab instance and nested prefab instance
5. Change the default value in the TestScript and save
==>
Wait until script is recompiled
6. Take a look into "DefaultValue" property value
==>
Actual: "DefaulValue" on the prefab instance is still 3.0f and "DefaultValue" is not an override
Expected: "DefaultValue" on the prefab instance is still 3.0f and "DefaultValue" property is added to overrides, scene becomes dirty
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
- Test Runner’s vertical scrollbar overlaps with the up and down arrows and upper toolbar tabs when the window is minimized
- The Input Field view is not updated when deleting lines of text
- The scrollbar does not respect empty lines in the Input Field
- “Texture Atlas Viewer“ button text overlaps another button when the UI Toolkit Debugger is narrowed
- Thresholds are no longer automatically calculated after deleting Motion fields in Blendtrees
Resolution Note:
It's not expected behavior that the instance should get overrides and the scene become dirty as the bug description says. Once a MonoBehavior has serialized a value for a property, the default value from the script doesn't have any effect anymore. This is how things always work for script properties.
Now, there is a question about behavior here because once a new value is added to a script, it's not immediately added to the serialization of the Prefab Asset on disk (only once some user change is made to the Asset) but it's dded to the serialization of the imported Library object. This means closing Unity, deleting the Library folder, and opening Unity again could make the property value on the imported Asset change to the new default value, which is probably not good. However, that's a different issue than the one described here.
In any case, it's not expected that the scene instance of the Prefab should get any overrides or the scene become dirty. If the value in the Asset changes, the instance is expected to just inherit that change without any overrides being added.