how to destroy an object and all of its children in unity code example
Example 1: unity delete all children
foreach (Transform child in transform) {
Destroy(child.gameObject);
}
Example 2: destroy all objects under parent unity c#
foreach (Transform child in TextHolder.transform) { GameObject.Destroy(child.gameObject); }