Question : unity delete all children
Answered by : ryuu
foreach (Transform child in transform) { Destroy(child.gameObject); }
Source : | Last Update : Sat, 13 Jun 20
Question : unity destroy all children
Answered by : concerned-curlew
while (transform.childCount > 0) { DestroyImmediate(transform.GetChild(0).gameObject);
}
Source : https://stackoverflow.com/questions/46358717/how-to-loop-through-and-destroy-all-children-of-a-game-object-in-unity | Last Update : Wed, 06 Apr 22
Question : Unity Destroy All Children
Answered by : mbilal-nawaz
void Update() { //put in any gameobject having children and enter playmode foreach (Transform child in transform) { Destroy(child.gameObject); } }
Source : | Last Update : Mon, 16 May 22