/// <summary>
/// 动态生成列表
/// </summary>
/// <param name="item"></param>
/// <param name="parent"></param>
/// <param name="count"></param>
/// <returns></returns>
private static GameObject[] AdjustItemList(GameObject item, Transform parent, int count)
{
for (int i = 1; i < parent.childCount; i++)
{
Destroy(parent.GetChild(i).gameObject);
}
GameObject[] itemList = new GameObject[count];
for (int i = 0; i < count; i++)
{
itemList[i] = Instantiate(item);
itemList[i].transform.SetParent(parent);
itemList[i].SetActive(true);
}
return itemList;
}
unity ui动态生成列表
最新推荐文章于 2024-01-08 12:14:33 发布