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
- Shader warnings are thrown after building High Definition 3D template
- "EndLayoutGroup: BeginLayoutGroup must be called first" error is thrown when changing Shader Precision Model from the Build Profiles window
- White artifacts/outlines are visible in the Garden Scene when viewing at meshes from a distance
- Shader warnings "Sprite-Unlit-Default" are thrown after building 2D Platrformer Microgame Template
- [Android] HLSL shader becomes corrupted when running on an Android device
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.