using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExerciseVideoPanel : MonoBehaviour { public GameObject VideoItem; public Transform ItemContent; private void OnEnable() { ClearContent(); CreatItem(); } void ClearContent() { for (int i = 0; i < ItemContent.childCount; i++) { Destroy(ItemContent.GetChild(i).gameObject); } } void CreatItem() { List list = VideoFileCtrl.Instance.PracticeDatas; for (int i = 0; i < list.Count; i++) { GameObject item = Instantiate(VideoItem, ItemContent); item.name = list[i].Name; item.GetComponent().Set(list[i]); } } }