I want to make a custom inspector that I'm not really sure how to approach. The idea is I have a quest framework with a class that holds onto the quest data and another class that is intended to hold onto dialogue data. The quest system is agnostic of my dialogue system.
I want to be able to display the quest and dialogue data this way:
QuestName0
- DialogueGiveQuest (TextAsset field)
- DialogueQuestIsActive (TextAsset field)
- DialogueQuestIsComplete (TextAsset field)
QuestName1
- DialogueGiveQuest (TextAsset field)
- DialogueQuestIsActive (TextAsset field)
- DialogueQuestIsComplete (TextAsset field)
etc...
Here's a pseudocode class layout
public class QuestData : MonoBehaviour
{
List<Quest> quests;
}
public class DialogueData : MonoBehaviour
{
public TextAsset dialogueGiveQuest;
public TextAsset dialogueQuestIsActive;
public TextAsset dialogueQuestIsComplete;
}
public class Interaction : MonoBehaviour
{
QuestData questData;
List<DialogueData> dialogueData;
}
[CustomEditor(typeof(Interaction))]
public class InteractionEditor : Editor
{
public override void OnInspectorGUI()
{
var interactionData = (InteractionData)target;
//foreach interactionData.questData.quests
// draw quest name
// make sure there's a dialogueData element for each quest
// draw field for each DialogueData
}
}
An obvious issue is dialogueData doesn't care about what's going on with questData.quests so if the inspector were to draw normally it would display 2 lists. I'd like the dialogue data to add and remove elements to itself depending on the quest data but that sounds like it be a real challenge to serialize.