Unity удалить всех детей
foreach (Transform child in transform) {
Destroy(child.gameObject);
}
CatgirlSimp
foreach (Transform child in transform) {
Destroy(child.gameObject);
}
while (transform.childCount > 0) {
DestroyImmediate(transform.GetChild(0).gameObject);
}
void Update()
{
//put in any gameobject having children and enter playmode
foreach (Transform child in transform)
{
Destroy(child.gameObject);
}
}
//put in any gameobject having children and enter playmode
while (transform.childCount > 0)
{
DestroyImmediate(transform.GetChild(0).gameObject);
}