Guest User

Untitled

a guest
May 25th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Networking;
  5.  
  6. public class LoadJson : MonoBehaviour
  7. {
  8.  
  9. // Use this for initialization
  10. IEnumerator Start()
  11. {
  12. var www = UnityWebRequest.Get("file://" + Application.streamingAssetsPath + "/demo.json");
  13.  
  14. yield return www.SendWebRequest();
  15.  
  16. Debug.Log(www.downloadHandler.text);
  17.  
  18. var demo = JsonUtility.FromJson<Demo>(www.downloadHandler.text);
  19.  
  20. Debug.Log(demo.Id);
  21. Debug.Log(demo.UserName);
  22. }
  23.  
  24. // Update is called once per frame
  25. void Update()
  26. {
  27.  
  28.  
  29. }
  30. }
  31.  
  32. [System.Serializable]
  33. public class Demo
  34. {
  35. public int Id;
  36. // public string UserID { get; set; }
  37. public string UserName;
  38. // public string LoginType { get; set; }
  39. // public string email { get; set; }
  40. // public int Coin { get; set; }
  41. // public string GameNoryaKey { get; set; }
  42. }
Add Comment
Please, Sign In to add comment