Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Serializable]
- public class Player
- {
- public string username;
- public string email;
- public string uid;
- public string game_data_json0;
- public string game_data_json1;
- public string game_data_json2;
- public string game_data_json3;
- }
- // Get cookies using GetCookie Jslib
- public string UID = "pirUJjkkId"; // Example
- public Player player;
- public IEnumerator GetScore()
- {
- WWWForm form = new WWWForm ();
- player = new Player();
- player.uid = UID;
- string json = JsonUtility.ToJson (player, true);
- form.AddField ("arrayData", json);
- // CHANGE
- WWW www = new WWW ("http://example-name.com/db-unity/GetValue.php", form);
- yield return www;
- if (www.error != null) {
- Debug.Log ("Error: " + www.error);
- yield break;
- } else {
- player = JsonUtility.FromJson<Player>(www.text);
- Debug.Log (player.uid);
- Debug.Log (player.username);
- Debug.Log (player.email);
- Debug.Log (player.game_data_json0);
- Debug.Log (player.game_data_json1);
- Debug.Log (player.game_data_json2);
- Debug.Log (player.game_data_json3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment