static void Init()
    {
        // Get existing open window or if none, make a new one:
        ConversationDataEditor window = (ConversationDataEditor)EditorWindow.GetWindow(typeof(ConversationDataEditor));

        window.data = XMLUtil.LoadResource <ConversationData>(ConversationData.FileName);
    }
 public static ConversationData GetData()
 {
     if (dataLoaded == null)
     {
         dataLoaded = XMLUtil.LoadResource <ConversationData>(ConversationData.FileName);
     }
     return(dataLoaded);
 }
    void OnGUI()
    {
        if (boldStyle == null)
        {
            boldStyle           = new GUIStyle(GUI.skin.label);
            boldStyle.fontStyle = FontStyle.Bold;
        }

        if (data == null)
        {
            GUILayout.Label("No data found");
            if (GUILayout.Button("Create new data"))
            {
                data = new ConversationData();
                XMLUtil.SaveResource(ConversationData.FileName, data);
            }
        }
        else
        {
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Save"))
            {
                XMLUtil.SaveResource(ConversationData.FileName, data);
            }
            if (GUILayout.Button("Load"))
            {
                data = XMLUtil.LoadResource <ConversationData>(ConversationData.FileName);
            }
            if (GUILayout.Button("Clear"))
            {
                if (EditorUtility.DisplayDialog("Warning!", "This will clear all data, are you sure?", "yes", "no"))
                {
                    data = new ConversationData();
                }
            }

            GUILayout.EndHorizontal();

            scrollPos = GUILayout.BeginScrollView(scrollPos);

            ChoiceList(data.choices, 0);

            GUILayout.EndScrollView();
        }
    }