📜  unity 保存列表到 json - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:52.051000             🧑  作者: Mango

代码示例1
public class MyList {
    public List list;
}

var class = new MyList();
var outputString = JsonUtility.ToJson(class);
File.WriteAllText("C:\\MyFile.json", outputString);

//In reverse, you can deserialize anything doing this:
var inputString = File.ReadAllText("C:\\MyFile.json");
var class = JsonUtility.FromJson(inputString);