Hello there
I’m trying to Serialize a List with objects from different kind of classes that inherit from one base class. This list should allow me both to see all the objects and their serialized variables. However, I can only see the variables from the base class but not the ones from the inherited ones. I believe this is due to the fact that when serialized all the child classes get turned into the base class. If this should be right, how can I solve this problem ?
I’m also wondering whether there is a way to get to a solution if I was able to serialize interfaces as all the child classes could inherit from that interface and the problem would be solved. But since I don’t have the money to buy odin Inspector nor ANY idea on how to implmement custom serialization that seems to be a dead end, too.
.
Well, at least for me. I hope that you are a generous genius that is willing to help
.
Ps: I hope that does make some sense… (if it doesn’t I would glad to specify myself further)
[Serializable]
public class Condition
{
[SerializeField] int intone;
//is visible
}
public class ConditionChild : Condition
{
[SerializeField] int inttwo;
//is not visible
}
[Serializable]
public class Transition
{
public Transition() { }
[SerializeField] public List<Condition> conditions = new List<Condition>();
}