更新于:2013.5.18
List lst = new List;
foreach (Transform child in transform)
{
lst.Add(child);
Debug.Log(child.gameObject.name);
}
for(int i = 0;i < lst.Count;i++)
{
Destroy(
lst[i]
.gameObject);
}
2014.5.20:
遍历foreach删除的方法只在运行时Destroy有延迟时有效,最好还是要将它储存到一个LIST里面用for循环一个个去删。