Interfaces inside vanilla classes are not serialized

Issue #243 invalid
Former user created an issue

Hi,

First of all, great tool! I'm in the process of switching from FullInspector to Odin and I'm having an issue with the following example:

using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;

public interface MyInterface
{
}

[System.Serializable]
public class InterfaceImplementation: MyInterface
{
    public string test;
}

[System.Serializable]
public class SomeClass
{
    public MyInterface wontShow;
    public InterfaceImplementation willShow;
}

[CreateAssetMenuAttribute()]
public class MyScriptableObject : SerializedScriptableObject
{
    public SomeClass someClass;
    public MyInterface willShow;
}

As the name implies, SomeClass.wontShow will not be shown in the inspector (and I assume, won't be serialized).

Am I missing something?

Comments (1)

  1. Tor Esa Vestergaard

    Odin's serialization is more frugal and conservative than Full Inspector's. Odin won't serialize the members that it knows Unity will serialize, unless you force it to. You can find more details here.

  2. Log in to comment