Created
May 21, 2018 08:34
-
-
Save mosluce/a28a375ff41e66eb1c345069eac40918 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment