// Use this for initialization void Start() { jsonString = File.ReadAllText(Application.dataPath + "/Resources/test.json"); RootObject stats = JsonMapper.ToObject <RootObject>(jsonString); //cmdData = JsonMapper.ToObject(jsonString); Debug.Log(stats.Name); Debug.Log(stats.Level); Debug.Log(stats.Stats[0]); jsonString_ = File.ReadAllText(Application.dataPath + "/Resources/test2.json"); RootObject_ stats_ = JsonMapper.ToObject <RootObject_>(jsonString_); Debug.Log(stats_.Stats[0][0] + " " + stats_.Stats[0][1]); Debug.Log(stats_.Stats[1][0] + " " + stats_.Stats[1][1]); Debug.Log(stats_.Stats[2][0] + " " + stats_.Stats[2][1]); cmdData_ = JsonMapper.ToObject(jsonString); }
void Start() { jsonString_ = File.ReadAllText(Application.dataPath + "/Resources/test2.json"); RootObject_ stats_ = JsonMapper.ToObject <RootObject_>(jsonString_); x_ = stats_.Stats [0][0]; y_ = stats_.Stats [0][1]; z_ = stats_.Stats [0][2]; x_1 = stats_.Stats [1][0]; y_1 = stats_.Stats [1][1]; z_1 = stats_.Stats [1][2]; x_2 = stats_.Stats [2][0]; y_2 = stats_.Stats [2][1]; z_2 = stats_.Stats [2][2]; gameObject.AddComponent <MeshFilter>().mesh = mesh; gameObject.AddComponent <MeshRenderer>().material = material; if (depth < maxDepth) { GameObject g1 = new GameObject("g1"); g1.transform.position = new Vector3(x_, y_, z_); g1.AddComponent <MeshFilter>().mesh = mesh; g1.AddComponent <MeshRenderer>().material = material; GameObject g2 = new GameObject("g2"); g2.transform.position = new Vector3(x_1, y_1, z_1); g2.AddComponent <MeshFilter>().mesh = mesh; g2.AddComponent <MeshRenderer>().material = material; GameObject g3 = new GameObject("g3"); g3.transform.position = new Vector3(x_2, y_2, z_2); g3.AddComponent <MeshFilter>().mesh = mesh; g3.AddComponent <MeshRenderer>().material = material; } //transform.position = new Vector3 (x_, y_, z_); }