标签:hid gen 需要 click str public json序列化 new ring
using Newtonsoft.Json; using System.Collections.Generic; using UnityEngine; public class JsonDe : MonoBehaviour { public class Produc { public string name = "sdf"; public int a = 1; public bool b = true; public float c = 2.1f; public Dictionary<string, string> dic = new Dictionary<string, string> { { "sdfsd", "654" }, { "dfsdf", "354" } }; public string[] ss = { "sdfsdf", "3213", "sdfsdf" }; public int[,] ves = new int[1, 2] { { 1, 2 } }; } void Start() { Produc produc = new Produc(); string json = JsonConvert.SerializeObject(produc); Debug.Log(json); Produc m = JsonConvert.DeserializeObject<Produc>(json); Debug.Log(m.ves[0, 0]); } }
需要用到Newtonsoft.Json.dll, 放到Plugins文件夹下面
csdn下载链接 https://download.csdn.net/download/gp1320099322/11932181
标签:hid gen 需要 click str public json序列化 new ring
原文地址:https://www.cnblogs.com/G993/p/11751818.html