Custom editor for inherited class but is not MonoBehaviour or ScriptableObject

Hi all,
to begin, here’s my code:

[Serializable]
public abstract class QuestTask
{
	public string Description;
}

public enum QuestGoalType
{
    Kill,
    Capture
}

[Serializable]
public class KillQuestTask : QuestTask
{
	public string Target;
	public int Amount;
}

[Serializable]
public class CaptureQuestTask : QuestTask
{
	public Item captureItem;
	public int Amount;
}

[Serializable]
public class QuestGoal
{
    public QuestGoalType questGoalType;
    public QuestTask questTask;
}

[Serializable]
public class Quest
{
    public string title;
    public string description;
	// .etc
	
    public List<QuestGoal> questGoalls = new List<QuestGoal>();
}

public class QuestGiver : MonoBehaviour
{
    public Quest quests;
}

How I should create an editor of QuestTask, in which I can change dynamically type of QuestGoalType and it will load the content of the inherited class. I mean, when I change the dropdown of enum on for example KillQuestTask, I should see all properties of KillQuestTask.

171744-img1.png

I want these classes to be serialized.

171755-img2.png

Or maybe there is some other way to achieve this effect? Easier way …?

Thanks in advance to everyone guys.

Have you tried using Scriptable Objects?

It will always be serialized and it gives us a more flexible way doing things.

171754-1.png

Here is the changes (note that it is a demo):

using System;
using System.Collections.Generic;
using UnityEngine;

 public class QuestTask : ScriptableObject
 {
     public string Description;
 }
 
 public enum QuestGoalType
 {
     Kill,
     Capture
 }

 [CreateAssetMenu]
 public class KillQuestTask : QuestTask
 {
     public string Target;
     public int Amount;
 }
 
 [CreateAssetMenu]
 public class CaptureQuestTask : QuestTask
 {
     public string captureItem;
     public int Amount;
 }
 
 [Serializable]
 public class QuestGoal
 {
     public QuestGoalType questGoalType;
     public QuestTask questTask;
 }
 
 [CreateAssetMenu]
 public class Quest : ScriptableObject
 {
     public string title;
     public string description;
     // .etc
     
     public List<QuestGoal> questGoals = new List<QuestGoal>();
 }
 
 public class QuestGiver : MonoBehaviour
 {
     public Quest quest;
 }