Json Serialization

定义简单序列化类或者结构

[Serializable]
public class MyClass
{
    public int level;
    public float timeElapsed;
    public string playerName;
}


用工具类JsonUtility,

ToJson(序列化类)  //转化为json字符串

FromJson(json)   //json转化为类

FromJsonOverwrite(json,myclass) //重写类


首页 我的博客
粤ICP备17103704号