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
- Shadows are not cast when the Light's CullingMask and the GameObject's Layer do not match
- Graphics.DrawMeshInstanced does not work when 2D Renderer and 2D Shaders are used
- SpeedTree does not move when using WindZone
- "Undeclared identifier 'LinearToSRGB'" error is thrown when creating a color variable with HDR color mode and assigning a Custom Render Texture target in Shader Graph
- Input System package is missing when creating a new HDRP project
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