- Home /
Flash and WWW Class
Hello there.
I was unable to build to Flash Player my game because i was using WWW CLASS, but that was until yesterday when i updated my unity to 3.5.2. Now i can publish the game but i have a problem and this is it :
I use (for now) the WWW class to call something like a WEBSERVICE on my WEBSERVER, and i call the webserver with a GET parameter, the webserver records my request on the database and then echoes a message of response ... my problem with flash is that the webserver is receiving the question from the game, so the request is correctly recorded on the database, but when i give unity the response text, unity flash gets an empty string > im using www.text. I tried to export the same package to unity web player and everything works just fine though.
Does anyone one can help me with this please ?
Thank you in advance.
$$anonymous$$aybe it would be helpfull if i say the code im using. So im using this to retrieve data from the server :
var form = new WWWForm();
form.AddField( "score", highscore );
var download = new WWW( 'mydomain.com/myscript.php', form );
// Wait until the download is done
yield download;
if(download.error) {
print( "Error downloading: " + download.error );
return;
txtHighScore.GetComponent(tk2dText$$anonymous$$esh).text = "err"+download.error;
txtHighScore.GetComponent(tk2dText$$anonymous$$esh).Commit();
} else {
// show the highscores
Debug.Log(download.text);
txtHighScore.GetComponent(tk2dText$$anonymous$$esh).text = ""+download;
txtHighScore.GetComponent(tk2dText$$anonymous$$esh).Commit();
}
So i know the server receives the request because i get the POST of the parameter 'score', and i can record it on the database.
If i use : txtHighScore.GetComponent(tk2dText$$anonymous$$esh).text = ""+download.score; i get the txtHighScore empty on FLASH, and the txtHighScore with the correct value on the unity web player. I've made this test : txtHighScore.GetComponent(tk2dText$$anonymous$$esh).text = ""+download; Running this o unity editor i get UnityEngine.WWW on the txtHighScore, and i get CLIObject on the txtHighScore if i run the FLASH version.
Please, help!? :S
Answer by catburton · Jun 20, 2012 at 01:35 PM
You can work around this issue currently by implementing your service call in pure AS3 within your Unity project. There is an example of how to do this here:
http://answers.unity3d.com/questions/266934/getting-fatal-error-2030-using-www-in-flash.html
Your answer
