Hi Everyone,
I am having trouble loading from XML on the iPhone. Here is the code:
function LoadXML()
{
var r : StreamReader = File.OpenText(docPath+"/highscores.xml");
var _info : String = r.ReadToEnd();
r.Close();
line=_info;
highscores = line.Split("%"[0]);
Debug.Log("File Read");
}
Here is the error I am getting:
DirectoryNotFoundException: Could not find a part of the path "/var/mobile/Applications/F0571EFE-3482-4183-8A8B-4F3498FB14FD/terraslam.app/highscores.xml".
I am placing the xml file straight in the assets folder. Where should I be putting it? or is the code wrong?
For reference this is also the code I am going to use to write to the XML. I am assuming this is wrong as well if the first bit is.
function CreateXML()
{
var writer : StreamWriter;
var t : FileInfo = new FileInfo(docPath+"/highscores.xml");
if(!t.Exists)
{
writer = t.CreateText();
}
else
{
t.Delete();
writer = t.CreateText();
}
writer.Write(lineToWrite);
writer.Close();
scoreText.text = "File written.";
}
Any help appreciated!!!
Thanks
Chris