Search Issue Tracker
Fixed in 2020.1.X
Fixed in 2019.3.X
[SerializeReference] Assets lose its Data when a Class name is changed
1. Download attached "SerializeReference.zip" project and open in Unity
2. Select "New Some Thing" gameObject in the Project window
3. Click from the main menu BugReport > Populate Selected Some Thing
4. While "New Some Thing" gameObject is selected in Inspector expand "Element 0" and notice it has a "Left" and "Right" item
5. Open Scripts/SomeThing.cs script
6. Rename the class "RootNode" to "RootNodeNewName" and save it
7. Switch back to Unity Editor
Expected results: Renaming class names should not cause Fata loss
Actual results: Observe that the Data is gone. "Element 0" no longer shows a "Left" and "Right" item and Console outputs Error:
"Unknown managed type referenced: [Assembly-CSharp] .RootNode"
- This issue appears on both Windows and macOS
- Could not check on Unity 2019.3.0a1 because the project becomes corrupted
- Customer copied the example snippet for the new [SerializeReference] feature from https://forum.unity.com/threads/serializereference-attribute.678868/#post-4543723
- Another Forum link: https://forum.unity.com/threads/serializereference-data-loss-when-class-name-is-changed.736874/#post-4915595
Reproduced on Unity 2019.3.0a2, 2019.3.0b3 and 2020.1.0a1
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Exception when adding column to multicolumntreeview with visible set to false
- “InvalidOperationException: System.InvalidOperationException” and “Assertion failed on expression” errors are logged when starting Server in Play mode
- [iOS] App freezes and the "You can attach a managed debugger now if you want” message doesn’t show up when running the app on iOS devices with the "Wait For Managed Debugger" setting enabled
- TouchScreenKeyboard.hideInput set from "true" to "false" when TextField is clicked in Android builds
- [Android] ReadPixels gives different results when using Vulkan on some devices
Nov 19, 2021 17:53
Still broken in 2021_2_2f1
Apr 28, 2021 23:20
It also happens in 2020.3.3f1 :(
Jan 16, 2021 14:32
2019.4.17f1: Issue happens, too. with class: MyLocaleSelector
Nov 19, 2020 14:04
Seeing this in 2020.1.11f1 when changing namespaces of ScriptableObjects.
I created a ScriptableObject asset, which has a [SerializeReference] List<T> where T is a [Serializable] public non-abstract class. I added a few items to the list. I then changed the namespace of some of the T classes.
Now, when I click on the asset in the Project view, Unity takes around 15s to update before I can edit it, and spits out some of the "Unknown managed type referenced" errors.
I notice that I change this asset in the inspector and then save/close unity, the asset file on disk does not update.
May 25, 2020 18:24
Happens on 2019.3.8f1 too
Feb 26, 2020 00:33
I am still seeing this issue in 2019.3.2f1 and 2020.1.0a24.
This behavior also occurs when the class is removed entirely from the assembly.
A huge consequence of this is that any collection containing an object that references the changed/deleted class will have all of its entries nullified, regardless of if they themselves have a reference to the class.
I have reported my specific problems in ticket #1218905.
Dec 05, 2019 08:05
Should be fixed in 2019.4
Nov 27, 2019 19:33
fixed in 2020 only? what about 2019.3