- Home /
How to retrieve XML path in standalone version
How can i load an XML file in standalone version if it's stored in my "Assets/Resources/Data/Chapters/" project folder? No problems in editor mode.
string FilePath = Path.Combine(Application.dataPath + "/Resources/Data/Chapters/", ChapterName + ".xml");
if (File.Exists(FilePath))
_XPathSettings = new XPathDocument(FilePath);
else {...}
Thanks.
Comment
Best Answer
Answer by Frenses · Mar 17, 2010 at 04:05 PM
You have to load that file from resources like this:
string FilePath = "Data/Chapters/" + ChapterName ;
TextAsset XMLFile = (TextAsset)Resources.Load(FilePath);
XmlDocument XmlDoc = new XmlDocument();
XmlDoc.LoadXml(XMLFile.text);
if (XMLFile != null)
_XPathSettings = new XPathDocument(new XmlNodeReader(XmlDoc));
else{...}