jeudi 7 avril 2016

Unity WWW request can i use more then one?

I have following code in game. The game checks the winner and loser and send the values to the database. The problem now is, that the game only calls 1 WWW Request wiich is strange.

if (playerDataScript.playerTeam == playerStScript.playerTeam)
        {
            GetComponent<AudioSource>().PlayOneShot(loseClip);
            Debug.Log ("You Lost");
                okayButton.SetActive (true);
                WWWForm form1 = new WWWForm ();
                form1.AddField ("user", PlayerPrefs.GetString (LoginSystem.Settings.accountKey.ToString ()));
                form1.AddField ("lose", "1");
                form1.AddField ("gold", Random.Range(50,71));
                form1.AddField("rating", Random.Range(17,31)); // Minus
                WWW saveData1 = new WWW ("http://ift.tt/1Sgqips",form1);
                yield return saveData1;
        }
        else
        {
            GetComponent<AudioSource>().PlayOneShot(winClip);
                okayButton.SetActive (true);
                WWWForm form = new WWWForm ();
                form.AddField ("user", PlayerPrefs.GetString (LoginSystem.Settings.accountKey.ToString ()));
                form.AddField ("win", "1");
                form.AddField ("gold", Random.Range(60,81));
                form.AddField("rating", Random.Range(17,31)); // plus
                WWW saveData = new WWW ("http://ift.tt/1VBgoUI",form);
                yield return saveData;
        }

My question: can i use 2 WWW Request with 2 different php files in the same script?




Aucun commentaire:

Enregistrer un commentaire