using System.Collections; using System.Collections.Generic; using UnityEngine; using XRTool.Util; public class UserList : UnitySingleton { public GameObject Item; public void Init(List inviteUserConfigList) { if (transform.childCount > 0) { for (int i = 0; i < transform.childCount; i++) { Destroy(transform.GetChild(i).gameObject); } } AddItem(inviteUserConfigList); } private void AddItem(List inviteUserConfigList) { for (int i = 0; i < inviteUserConfigList.Count; i++) { GameObject obj = Instantiate(Item, transform) as GameObject; obj.transform.GetComponent().Init(inviteUserConfigList[i]); } } public void DestoryAll() { if (transform.childCount > 0) { for (int i = 0; i < transform.childCount; i++) { Destroy(transform.GetChild(i).gameObject); } } } }