- changed status to open
Interface selector will not allow selection of class derived from SerializedScriptableObject that also implements interface
Unity 5.6.1f1 Odin 1.0.1.5
If a class is derived from SerializedScriptableObject and implements an interface, it will not show up in the selector for a interface field. I updated the code in your SerializeAnything.cs example script. You will see the class called problem class. In the image below you can see problem class is not one of the options that is selectable. Only ImpA and ImpB are selectable.
Comments (7)
-
-
- marked as enhancement
- changed title to (Edit: Will be resolved by new Type Resolver) -- Interface selector will not allow selection of class derived from SerializedScriptableObject that also implements interface
-
reporter So an update. I mocked out the exact structure we are using when we ran into this issue. Again I have updated the SerializeAnything.cs file. You cannot drag a scriptable object asset into that area even if it inherits from the interface that is expected there. Please check out this new script. I made a quick class in there with the CreateAsset attribute so you can quickly made a scriptable object asset to test with. This is exactly how our stuff is setup.
You will need to add an item to both the array and the list in the array to expose the interface selector.
-
reporter - attached SerializeAnything.cs
-
- changed status to resolved
I see - I'm sorry for misunderstanding the issue before, I've reproduced this and understand the problem now. The type selector is not meant to be able to select an asset yet, but you should be able to drag compatible values into it.
I've spent some time going through the code and implementing a fix for this, which will make it into the next patch. Thanks for your patience, and for reiterating the point with your examples.
-
- changed title to Interface selector will not allow selection of class derived from SerializedScriptableObject that also implements interface
-
reporter Thank you for the updates.
- Log in to comment
We do not currently support creating instances (or assets) of UnityEngine.Object derived types to populate properties, nor "finding" UnityEngine.Object-derived instances (or assets) through an "object selector" for fields which are not UnityEngine.Object derived (such as an interface). We are, however, working on a much improved type resolver, which will be able to handle this case and many, many others (constructors, etc).
Meanwhile, I'm afraid you'll have to create a scriptable object asset yourself in the project, and drag it onto the field.