- Home /
Dynamic changing type in ReorderableList
Hi all, It is possible to change the type of object in the ReorderableList? I mean, in the time when is drawing element in "DrawElementCallback", I would like change type of element. I would like to mention, that all my objects inheriting from one object. And I want to change the type dynamically in a "DrawElementCallback" method.
For example, this is my code:
public class Quest : ScriptableObject
{
public enum QuestGoalType
{
Kill,
Gather
}
public QuestGoalType questGoalType;
public List<QuestGoal> questGoalls = new List<QuestGoal>();
}
public class QuestTask
{
public string Description;
public int Count;
}
[Serializable]
public class GatherTask : QuestTask
{
public string Target;
public int Anount;
}
[Serializable]
public class KillTask : QuestTask
{
public GameObject Targer;
public int Amount;
public string Name;
}
ReorderableList is creating in the editor of Quest object. When I change the value of questGoalType and push a button, I add an appropriate object.
Maybe someone knows about a better solution? Or maybe is something better than ReorderableList?
Comment