My game needs to get a string from a xml doc on my website. This all worked fine when the game was in standalone, but due to security reasons Webplayers are a bit more complicated.
I’ve set up my crossdomain.xml at my websites root folder and everything is working out fine. But here is the problem. I know how to get a string from xml in standalone from website. I know how to set up the crossdomain. But I don’t know how to get the value after setting up the domain.
Either I’m really stupid right now, or there is something missing in the docs.
Should the string I want to get be in the crossdomain file? Or what am I supposed to do now?
As it is now I have a crossdomain file looking like this:
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*"secure="false"/>
</cross-domain-policy>
at:
http://WEBSITE.com/crossdomain.xml
and the string at:
http://WEBSITE.com/MasterIP.xml
How should I go about getting the string now?
My old code did this, which works on standalone:
IEnumerator GETIP(){
WWW www = new WWW("http://WEBSITE.com/MasterIP.xml");
while(!www.isDone)
{
yield return new WaitForSeconds(0.1f);
}
string wwwtext = ASCIIEncoding.ASCII.GetString(Encoding.Convert(Encoding.UTF8,Encoding.ASCII,www.bytes));
Debug.Log("new xmldoc");
XmlDocument result = new XmlDocument();
Debug.Log("loadxml");
try
{
result.LoadXml(wwwtext);
}
catch{}
Debug.Log(result.InnerText.ToString());
masterIP = result.InnerText.ToString();
return false;
}
It returns the IP without a problem. But when using Webplayer and crossdomain, how should I go about to fetch the IP?
First time using xml and WWW in unity so sorry if the answer is obvious.