private void AddInstance(QuestMachineConfiguration instance)
 {
     if (instance == null)
     {
         return;
     }
     if (!m_instances.Contains(instance))
     {
         m_instances.Add(instance);
     }
     instance.SetAsPrimaryInstance();
 }
 private void Awake()
 {
     if (m_allowOnlyOneInstance && m_instance != null)
     {
         Destroy(gameObject);
         return;
     }
     m_instance         = this;
     QuestMachine.debug = debugSettings.debug;
     RegisterQuestDatabases();
     AddInstance(this);
 }
 private void RemoveInstance(QuestMachineConfiguration instance)
 {
     if (instance == null)
     {
         return;
     }
     m_instances.Remove(instance);
     m_instances.RemoveAll(x => x == null);
     if (instance == m_instance)
     {
         m_instance = (m_instances.Count > 0) ? m_instances[m_instances.Count - 1] : null;
     }
 }
 private void SetAsPrimaryInstance()
 {
     m_instance = this;
     QuestMachine.defaultQuestDialogueUI     = questDialogueUI as IQuestDialogueUI;
     QuestMachine.defaultQuestJournalUI      = questJournalUI as IQuestJournalUI;
     QuestMachine.defaultQuestAlertUI        = questAlertUI as IQuestAlertUI;
     QuestMachine.defaultQuestHUD            = questHUD as IQuestHUD;
     QuestMachine.completedQuestDialogueMode = completedQuestDialogueMode;
     QuestMachine.prettyPrintJson            = prettyPrintJson;
     QuestMachine.debug                         = debugSettings.debug;
     MessageSystem.debug                        = debugSettings.debugMessageSystem;
     QuestGenerator.detailedDebug               = debugSettings.debugQuestGenerator;
     QuestGenerator.maxSimultaneousPlanners     = generatorSettings.maxSimultaneousPlanners;
     QuestGenerator.maxGoalActionChecksPerFrame = generatorSettings.maxGoalActionChecksPerFrame;
     QuestGenerator.maxStepsPerFrame            = generatorSettings.maxStepsPerFrame;
     DomainType.SetPlayerDomainInstance(generatorSettings.defaultPlayerDomainType);
 }