在web上 需要用Resources来进行加载,否则读取不到
/// <summary> /// 加载xml文档 /// </summary> /// <returns></returns> public static XmlDocument ReadAndLoadXml() { XmlDocument doc = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load("XMLFile1"); Debug.Log("加载xml文档"); doc.LoadXml(textAsset.text); return doc; }