Search Issue Tracker
By Design
Votes
1
Found in
2019.3
2019.3.10f1
2020.2
Issue ID
1241777
Regression
No
Using [SerializeReference] with an interface object results in a missing input field in the Inspector
How to reproduce:
1. Open the user-supplied project ("testproj.zip")
2. Open the "SampleScene" and inspect the "GameObject" GameObject
3. Navigate to the "Test User" Script Component in the Inspector view and observe it
Expected result: the interface object "Test" has a reference input field
Actual result: the interface object only has its label and no input field for a reference
Reproducible with: 2019.3.15f1, 2020.1.0b11, 2020.2.0a13
Could not test with: 2018.4 due to [SerializeReference] not being present
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
- Certain textures are incorrectly marked in the render pass list when observed through Render Graph Viewer
- "Assertion failed on expression" error occurs when multiple Animation Components are instantiated after changing the Culling Type
- MacOS persistentDataPath uses old path when built compared to Editor Play mode
- Crash on RaiseException when entering Play Mode in a specific project
- Debug Console does not reappear when disabling and re-enabling Debug.developerConsoleEnabled
Resolution Note (2020.2.X):
SerializeReference are aimed at allowing referencing Serializable C# classes not derived from UnityEngine.Objects and allowing those to be saved by reference rather than by value on a single ScriptedObject/MonoBehaviour instance. In the provided use case the MonoBehaviour was deriving from an interface and a SerializeReference field of that interface types was used. In order to achieve what you aimed you can use a specific MonoBehaviour type on a regular SerializedField.By default objects are saved as references in Unity in such scenario case. Hope this helps. For extra information on SerializeReference https://docs.unity3d.com/ScriptReference/SerializeReference.html