How to serialize a concrete derived class from generic ScriptableObject base

I would like to use a generic ScriptableObject class as a base for multiple children, which then should be serialized. I thought this would work the same way it does with normal generic classes and concrete serializable child classes, but apparently it doesn’t:

// Not serializable.
public class GenericClass<T>
{
	public T Data;
}

// Serializable.
[System.Serializable]
public class ConcreteClass : GenericClass<int> { }

// Not serializable.
public class GenericSO<T> : ScriptableObject
{
	public T Data;
}

// Should be serializable, but isnt. Why?
public class ConcreteSO : GenericSO<int> { }

Am I doing something wrong or is there a reason that ScriptableObject derived classes won’t serialize although they are concrete implementations of the generic base? Is there a smart way around this? I basically I want the base class to hold a KeyValuePair-like data structure, for which the value is always of the same type, but the key is different. Subclassing this with normal classes makes sense and works fine, but I want instances as assets, so I need SO.

Thanks for any suggestions! :slight_smile:

Mark ConcreteSO and GenericSO´1 class definitions with a System.Serializable attribute as you did with ConcreteClass. That should do for serializing ConcreteSO fields.