/// <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动态生成列表
猜你喜欢
转载自blog.csdn.net/weixin_47819574/article/details/130925250
今日推荐
周排行