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
- Crash on SerializedProperty:CopyInternalImpl when clicking on a specific Asset
- Crash on BurstCompilerService::CompileAsync when opening a specific project
- [Android] Particles aren't rendered when the shader "Particle/Standard Unlit" or "Particles/Standard Surface" is used on a Material
- Crash on nvoglv64.dll when opening a project
- [RenderGraph] [CameraStacking] Passes are failing when CameraStacking and RG are enabled
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