Search Issue Tracker
By Design
Votes
0
Found in
2020.3.7f1
2021.1
2021.1.10f1
2021.2
2022.1
Issue ID
1344426
Regression
Yes
Assembly Definition Scriptable Objects loses serialized values when assets are renamed during Play Mode
Reproduction steps:
1. Open the attached project ("ReproBugRename.zip")
2. Open the "SampleScene" scene: Assets > Scenes
3. Enter the Play mode
4. Observe the created assets in the "Assets" folder
5. Left-click on the Game window to modify the values of the created assets
6. Left-click again, to rename the created assets
Expected result: Once the Assembly Definition Scriptable Object is renamed using AssetDatabase.RenameAsset(), the modified values are not changed
Actual result: When the Assembly Definition Scriptable Object is renamed using AssetDatabase.RenameAsset(), the values are changed back to default
Reproducible with: 2020.3.7f1, 2020.3.14f1, 2021.1.14f1, 2021.2.0b3, 2022.1.0a1
Not reproducible with: 2018.4.36f1, 2019.4.29f1, 2020.3.6f1
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:
This change in behaviour is by design. We recently made sure that moving/renaming assets correctly updated the main object name to match the filename. This meant that renamed assets effectively become new assets at some level, and in-memory/unsaved changes are carried over by saving the dirty asset data into the 'new' asset.
When changing fields on a ScriptableObject, the object is not automatically dirtied, and these changes can be lost. The solution is to mark the object dirty using EditorUtility.SetDirty() when modifying fields. That way, the changes will be preserved in the renamed/moved asset.