实现代码如下:
/// <summary>
/// 预制体所在的父物体
/// </summary>
public GameObject ranklist;
for (int i = 0; i < ranklist.transform.childCount; i++)//循环删除
{
Transform List_child = ranklist.transform.GetChild(i);//获取子物体
Destroy(List_child.gameObject);//删除子物体
}