I have a class hierarchy with an abstract parent class.
I would like to have a field of this type exposed to the inspector but it appears to not display.
This test code:
[Serializable]
public abstract class AbstractClass
{
public string testField;
public AbstractClass(string testValue)
{
testField = testValue;
}
}
[Serializable]
public class ConcreteClass : AbstractClass
{
public ConcreteClass(string testValue) : base(testValue)
{
}
}
public class MonoBehaviourClass : MonoBehaviour
{
public AbstractClass abstractClass = new ConcreteClass("abstract");
public ConcreteClass concreteClass = new ConcreteClass("concrete");
}
Produces this result:
As you can see the field for the abstract class is missing.
How can I expose a field of an abstract type to the inspector?