Search Issue Tracker
By Design
Votes
0
Found in
2019.3
2019.3.0b6
2020.1
Issue ID
1189932
Regression
No
[SerializeReference] Self-referencing fields are not serialized when creating an asset from a class using CreateAssetMenu
How to reproduce:
1. Open the user attached project using the EnvIronman VM
2. Go to Assets -> Create -> FlowNodeBug in the top menu bar
3. Check the created Asset in the Project Window
Expected results: 'Next' and 'Prev' fields are serialized in the WrappedFlowNode Class (see attached screenshot)
Actual results: 'Next' and 'Prev' fields are not serialized
Reproducible with: 2019.3.0a2, 2019.3.0b9, 2020.1.0a11
The project on Unity versions 2019.3.0a1 and earlier could not be tested due to compilation errors
Additional note: The fields are serialized successfully if a class is attached to a GameObject
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
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
Resolution Note:
Self referencing fields (fields that have the same type as the hosting managed class) are not supported by the Unity serialization and therefore not considered during the serialization/transfer process. A workaround is indeed to use an interface.