using LitJson;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ListInformation : MonoBehaviour
{
public List<GameObject> contents;
[SerializeField] GameObject prefab; //预制体
[SerializeField] GameObject parent; //父物体(content)
// Start is called before the first frame update
void Start()
{
TextAsset jsonFile = Resources.Load<TextAsset>("testfile");
string jsonString = jsonFile.text;
Root data = JsonMapper.ToObject<Root>(jsonString);
GameObject item = Instantiate(prefab, parent.transform);
contents.Add(item);
contents[0].transform.GetChild(0).GetChild(0).GetComponent<Text>().text = data.Name;
}
}