x


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.

more ▼

asked Mar 17 '10 at 01:55 PM

Frenses gravatar image

Frenses
27 5 5 11

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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{...}
more ▼

answered Mar 17 '10 at 04:05 PM

Frenses gravatar image

Frenses
27 5 5 11

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x255
x241
x237

asked: Mar 17 '10 at 01:55 PM

Seen: 1898 times

Last Updated: Mar 17 '10 at 01:55 PM