Hi, i have script that gives me my HighScore from sql base.
Everything works fine in editor and standalone version but its doesnt work on WebGL.
I checked that in my base are new scores, so game sends information, but cant get them back. I have no idea how to check more specify what is wrong. I just dont get any fatal error and my table with highscore is empty. Any ideas?
Sorry for bad english
WWWForm form = new WWWForm();
form.AddField("limit", getLimitScore);
WWW www = new WWW(GetHighscoreUrl, form);
yield return www;
if (www.text == "")
{
print("There was an error getting the high score: " + www.error);
}
else
{
podzielonyTekst = www.text.Split('@');
glownyTekst = "";
for (int i = 1; i < podzielonyTekst.Length - 2; i++)
{
glownyTekst += podzielonyTekst[i].Split('
Does your “print” fire, or does it get stuck waiting for the request?
You should check the Javascript console in your browser to see whether it’s reporting an error there, for example a cross-domain problem would be reported by the browser in that console.
It depends on the browser - in Chrome it is Ctrl-Shift-C. In Firefox I think it might be Ctrl-Shift-K or Ctrl-Shift-J. It’s the best way to monitor what your app is doing, all your debug output goes here along with any errors from the browser.
Wow, really thx bro, i found this console and its says that i cant get data from taht server and i need to have all files on the hosting that i have my domain, i have hope that it will work, so i will try it tomorrow, really thanks
If you do need to fetch data from a different domain, you need the different domain to supply a crossdomain.xml file, just like with the Webplayer. It’s easier if you can just upload everything to the same server though. Good luck.
Hey, i tried to upload everything to one server but then it doesnt work at all …
When i try like last time, its says that i can use CORS, i cant find any good tutorial for this.
And in console its shows many error PlayerPrefs will not be saved, but in game there are not any rpboelms, should i be worried?
It says here what you need to do to get cross-domain requests working with WebGL. It looks like it’s not crossdomain.xml, but server headers. I haven’t tried this though, so can’t say for sure. This from Unity Answers seems to imply that crossdomain.xml does work. Or maybe the poster just had a permissive server already.
Ok, i get it now, you need to paste it in your php file on your server before doing anything
smth like this
<php
header(“Access-Control-Allow-Credentials: true”);