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
- Code runs slower when using a cached exception instance compared to creating a new one
- Broken UI in Default Preset Add Section of "Preset Manager" window
- [iOS] The Player freezes when closing the Notification Center and quickly swiping down from top
- Crash on Texture2D:SetPixelImpl when rapidly calling Texture2D.Apply()
- Graph Lines are not rendered when using Experimental GraphView or GridBackground
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.