- Home /
Unity CrossDomain.xml Still Required? What is wrong?
I am trying to make a highscore system in Unity. Nothing I have found here on Unity Answers, or in the Unity Manual, Reference or Scripting API has an answer that I haven't tried.
I am getting several errors, neither consistently. The first is the 'crossdomain.xml' policy file not found error. The second is the return data is empty. I know the MySQL db is setup and populated with data as we have been able to test it out manually and retrieve our highscores.
Everything is located on the same server. This tells me I shouldn't need crossdomain.xml, but I have one anyway because it wasn't working without it. Still isn't.
crossdomain.xml looks like this. I edited it using Notepad and use Save As to ensure it's encoding is UTF-8.
<?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
The crossdomain.xml file is located on the root of the server, where it's supposed to be.
We use this C# code to make the request for the highscores.
StartCoroutine (GetScore());
We use this C# code to execute the request.
public IEnumerator GetScore() {
int retrieveLimit = 10;
int level = 1;
WWWForm form = new WWWForm();
form.AddField ("limit", retrieveLimit);
form.AddField ("level", level);
WWW www = new WWW("www.sampleserver.com/path/getHighscore.php", form);
yield return www;
// do stuff with www.text (shown below)
}
getHighscore.php is located in a folder with the game. To pull highscores we are using this php code to talk to an MySQL db:
$query = "SELECT * FROM ScoreTable WHERE level=$level ORDER BY score ASC LIMIT $limit";
$result = mysql_query($query);
When we go to read the retrieved highscores, we find nothing. (C#)
String s = www.text;
Debug.Log ("found: " + s); // shows nothing
Or we get the 'crossdomain.xml' policy file not found error.
Can anyone please tell me what I am doing wrong? I've been working on this for several days. I've googled and searched everything I can find. I've scoured UnityAnswers, Unity Forums, the Unity Script Reference, the Unity Manual, and the Unity API Reference. I have downloaded 3 different HighScore packages from the Unity Asset Store and gone through their code. I have done and checked everything I could find. I can't find anything wrong. What's left to try?
Thanks
Your answer
Follow this Question
Related Questions
Unity and a Server 1 Answer
Retrieving data from a WWW php call? 1 Answer
Unity php functions 1 Answer
help to call noramlisd database to unity 0 Answers
A node in a childnode? 1 Answer