Skip to content

Instantly share code, notes, and snippets.

@mosluce
Created May 21, 2018 08:34
Show Gist options
  • Save mosluce/a28a375ff41e66eb1c345069eac40918 to your computer and use it in GitHub Desktop.
Save mosluce/a28a375ff41e66eb1c345069eac40918 to your computer and use it in GitHub Desktop.
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