private void OnGUI() { if (GUILayout.Button("New Quest")) { QuestEditor.ShowWindow(); } EditorGUILayout.LabelField("QUESTS", EditorStyles.boldLabel); EditorGUI.indentLevel++; DisplayQuestLabels(quests.mainQuests); DisplayQuestLabels(quests.secondaryQuests); DisplayQuestLabels(quests.hunts); DisplayQuestLabels(quests.freeQuests); DisplayQuestLabels(quests.officialQuests); DisplayQuestLabels(quests.criticalQuests); DisplayQuestLabels(quests.backstories); DisplayQuestLabels(quests.reputationQuests); DisplayQuestLabels(quests.secretQuests); EditorGUI.indentLevel--; EditorGUILayout.Space(15); if (GUILayout.Button("Save Quests")) { QuestUtilities.SaveAllQuestsToJSON("Quests.json", quests); } }
private void Awake() { quests = new Quests(); // We try to retrieve all the quests from the JSON file try { quests = QuestUtilities.GetAllQuestsFromJSON("Quests.json"); } // Otherwise, we log the error catch (Exception e) { Debug.Log(e); } }