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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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.