- Home /
Serialize variables of elements in a list ?
Hey folks ^_^
I'm looking for a way to show the serialized variables of elements in a serialized list. I have a class "Transition" that has a serialized List. This list contains different objects from one of the classes that derive from the base class "Condition" that derives from MonoBehavior. Now these child classes have different serialized fields that I need to see in my list. However, they don't show up:
public class Transition
{
[SerializeField] public List<Condition> conditions = new List<Condition>();
}
public class Condition : MonoBehaviour
{
[SerializeField] int intone;
}
public class Condition_Compare : Condition
{
[SerializeField] int inttwo;
}
So neither intone or inttwo shows up. However, when Condition does not derive from MonoBehavior intone shows up. But the List does not work any longer as it turns all objects of classes that derive from Condition like Condition_Compare to an instance of Condition.
.
As always I hope you are a generous genius that is willing to help. Thank you a lot for your time ^_^
Your answer
Follow this Question
Related Questions
Difference between assigning a value in inspector and with a custom editor script 1 Answer
How do I make child classes in a list editable from the Inspector? 1 Answer
Serialising subclass variables in inspector 2 Answers
*Really* need help on Serialisation, stuck on this for over a week now, deadline looming 1 Answer