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
- Create Node Menu is not closing and “NullReferenceException: Object reference not set to an instance of an object” error is thrown when Shader Graph window is closed
- Assert error is thrown when the Editor language is set to one of the experimental ones in an HDRP project
- A BatchDrawCommand is using a pass from the shader “Universal Render Pipeline/Particles/Lit” that is not SRP Batcher compatible
- The Scene does not get rendered in the Player when MSAA is enabled and more than one Camera is used
- Crash on mono_object_get_class when generating Font Atlas of a specific font file
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