UnityEvent referens to custom editor from inside array of class and editor losing settings

Hello.

I am currently working on a small system to help some younger kids get into Unity a bit quicker without them having to do the actual code to start with. Currently I am trying to get a sort of quest system going but so far I have two problems when building the custom editor for the system.

Firstly getting the UnityEvent object into the editor from the class is proving troublesome.
There are a few similar questions here but I am working with a list of the custom class QuestType and so far I have not seen any answers working with lists.

Secondly as soon as I press play any values/settings entered into the custom editor vanish.

Any help will be much appreciated.

Quest type class

[System.Serializable]
public class QuestType
{
    public string Name;
    public string Desc;
    public int Goal;
    public int Current;
    public bool Active;
    public UnityEvent IsDone;
}

QuestEditor

using UnityEditor;

[CustomEditor(typeof(QuestHandler))]
public class QuestEditor : Editor
{

    public override void OnInspectorGUI()
    {
        QuestHandler questHandler = (QuestHandler) target;

        questHandler.NumberOfQuests = EditorGUILayout.IntField("Number of Quests", questHandler.NumberOfQuests);
        EditorGUILayout.Space();

        for (int i = 0; i < questHandler.NumberOfQuests; i++)
        {
            EditorGUILayout.BeginVertical();

            EditorGUILayout.LabelField("Quest ID: " + i);
            questHandler.Quests_.Name = EditorGUILayout.TextField("Quest name", questHandler.QuestNames*);*_

questHandler.Quests_.Active = EditorGUILayout.Toggle(“Quest Active”, questHandler.Quests*.Active);*_

EditorGUILayout.LabelField(“Quest description”);
questHandler.Quests_.Desc = EditorGUILayout.TextArea(questHandler.Quests*.Desc);*_

questHandler.Quests_.Goal = EditorGUILayout.IntField(“Quest goal number”, questHandler.Quests*.Goal);*_

questHandler.Quests_.Current = EditorGUILayout.IntField(“Quest start number”, questHandler.Quests*.Current);*_

//Event here

EditorGUILayout.Space();
EditorGUILayout.EndVertical();
}

}
}

I’m not entirely clear on your first question, but as for your question question, you really should be using SerializedProperty here instead of directly modifying properties on the target object, as that type of editing will not actually dirty the serialized data without some other work on your part (and consequently does not flush changes to disk, is not compatible with Undo/Redo, etc.). I strongly suggest checking out the example in the documentation for Editor.

If you are wanting to customize how QuestType objects appear in the inspector, I suggest creating a custom PropertyDrawer rather than doing that work inside of your Editor.