Answer the question
In order to leave comments, you need to log in
How to display all fields of inherited classes using Odin Inspector in Unity?
Hello.
There is such a simple example:
using System;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Examples
{
[CreateAssetMenu(fileName = "Enemies", menuName = "Enemies", order = 0)]
public class Enemies : ScriptableObject
{
public List<Enemy> list = new List<Enemy>();
[Serializable]
public class Enemy
{
public int id;
}
[Serializable]
public class Dragon : Enemy
{
public string name;
}
[Serializable]
public class Robot : Enemy
{
public double damage;
}
[Button]
public void AddRobot()
{
list.Add(new Robot());
}
[Button]
public void AddDragon()
{
list.Add(new Dragon());
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question