Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Networking;
- public class LoadJson : MonoBehaviour
- {
- // Use this for initialization
- IEnumerator Start()
- {
- var www = UnityWebRequest.Get("file://" + Application.streamingAssetsPath + "/demo.json");
- yield return www.SendWebRequest();
- Debug.Log(www.downloadHandler.text);
- var demo = JsonUtility.FromJson<Demo>(www.downloadHandler.text);
- Debug.Log(demo.Id);
- Debug.Log(demo.UserName);
- }
- // Update is called once per frame
- void Update()
- {
- }
- }
- [System.Serializable]
- public class Demo
- {
- public int Id;
- // public string UserID { get; set; }
- public string UserName;
- // public string LoginType { get; set; }
- // public string email { get; set; }
- // public int Coin { get; set; }
- // public string GameNoryaKey { get; set; }
- }
Add Comment
Please, Sign In to add comment