How would you load an XML file without locking up the whole game interface?
at the moment my code is like this. It compiles fine and does its job. Its just it takes a few seconds before anything can animate again.
var xmldoc = new System.Xml.XmlDocument();
var iospath : String = Application.dataPath.Substring (0, Application.dataPath.Length - 5);
iospath = iospath.Substring(0, iospath.LastIndexOf("/"));
iospath = iospath + "/Documents";
var fileFullName : String;
fileFullName = iospath + "/MinorItem.xml";
if (!File.Exists(fileFullName)) {
//Debug.Log ("File not exists");
var tWWW = new WWW("https://whatever.com/xml/xmlGetMinorItem.asp");
yield tWWW;
Debug.Log(tWWW.text);
var swtr : StreamWriter = new StreamWriter(fileFullName);
Debug.Log(swtr.Encoding);
swtr.Write(tWWW.text);
swtr.AutoFlush = true;
swtr.Close();
Debug.Log ("File exists:" + File.Exists(fileFullName)) ;
}
var srdr : StreamReader = File.OpenText(fileFullName);
var xmlString : String = "";
xmlString = srdr.ReadToEnd();
xmldoc.LoadXml(xmlString);
var node : System.Xml.XmlNode;
var nodeList : System.Xml.XmlNodeList;
nodeList= xmldoc.SelectNodes(GalleryXMLPath);
var t : GameObject;
var sname : String;
var productcode : String;
var textData :TextMesh;
node = nodeList.ItemOf[0];
var iTotal : Int16 = int.Parse(node.Item["TOTALPAGES"].InnerText);
PagesCount = iTotal ;
}