コード例 #1
0
    public static DialogueTree LoadTree(string path)
    {
#if UNITY_EDITOR
        AssetDatabase.Refresh();
#endif
        TextAsset file = Resources.Load <TextAsset>(path);
        if (file == null)
        {
            Debug.LogErrorFormat("There was a problem loading {0}", path);
            return(null);
        }
        TextReader   reader = new StringReader(file.text);
        DialogueTree d      = XMLUtility.ReadXML <DialogueTree>(reader, file.name);
        if (d == null)
        {
            Debug.LogErrorFormat("There was a problem parsing {0}", file.name);
        }
        else
        {
            Debug.LogFormat("Successfully Loaded {0}", file.name);
        }
        return(d);
    }