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();
}
}
}