So not sure what is up here. I am looking to pass an XML object that I created in one function to another function but am getting some weird errors.
My code (simplified) looks like this:
function handleContent(){
var xml = new XmlDocument();
xml.LoadXml(contentStr);
if (xml.HasChildNodes){
Debug.Log(xml.FirstChild.ChildNodes.Count);
Debug.Log(xml.FirstChild.ChildNodes[0].OuterXml);
xmlTest(xml);
} else {
Debug.Log("Not XML");
}
}
function xmlTest(xml){
Debug.Log("TEST: " + xml.FirstChild.ChildNodes[0].OuterXml);
}
In the xmlTest function an error will occur that reads:
‘MissingFieldException: Cannot find variable ChildNodes’
Now the real fishy part is the two debug lines above the call to xmlTest work perfectly fine and note the second debug line in the handleContent function and the debug line in the xmlTest function are the same.
Anyone have any thoughts?
Thanks!
– Clint