xxxxxxxxxx
foreach (Transform child in transform)
child.gameObject.SetActive(false);
xxxxxxxxxx
while (transform.childCount > 0) {
DestroyImmediate(transform.GetChild(0).gameObject);
}
xxxxxxxxxx
void Update()
{
//put in any gameobject having children and enter playmode
foreach (Transform child in transform)
{
Destroy(child.gameObject);
}
}