Highscores PHP issue unity crash -- "Too many Thr

Hey folks, I’m integrating the server side highscores system found here:

http://www.unifycommunity.com/wiki/index.php?title=Server_Side_Highscores

… Which is awesome, so thank you Kevin Lindeman.

However, I’m having some trouble. I can access my database just fine, and submit new entries. reading it is weird though. this php script:

http://www.greenergrassgames.com/loonpop/display.php

isn’t really working. for some people, it works the first time they click it, but not the second. for me, it doesn’t work at all anymore. HOWEVER… if i change the NAME of the script:

http://www.greenergrassgames.com/loonpop/dismay.php

it works fine for me, every time… And I’ve only changed the name. I haven’t edited the script at all.

However, even if I change my unity script to reference dismay.php, it’s still causing a problem. If I run the game in the editor or stand alone, i get a crash with an dialog box telling me “too many threads”.

the web player doesn’t hang or crash, it just chills there and doesn’t return a damn thing.

any ideas? i am completely confused and lost.

Not sure why Unity is throwing out that exception - but it might be worth checking your apache logs for php errors - just in case. It might be that your running a version of PHP that isnt directly compatible - although I doubt it.

Also, whilst its not really necassary - its good practice to close the mysql connection.

So at the end of each script before the ?> you should have

for display.php
mysql_close($database);

for addscore.php
mysql_close($db);

How many WWW connections are you creating? I’m sure you make way too much requests inside unity.

UGH! thank you. I’m an idiot.

HAHAHA I had the bloody… WWW line being called every frame. hahah awesome. The whole thing works fine now.

Thanks for your help guys. AbsoluteBreeze, thanks a lot for the tip… I’ll make sure that I remember it. what’s the reason to close the database? is it security?

I’m worried about pinging the hell out of the server that my database is on… those extra few instructions won’t jam things up if many people connect at once, will they?

(i’m a noob)

Thanks again guys. I feel miles better.