Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# unity destroy all child gameobject

public GameObject objParent;

// Destory every child game object
for (int i = objParent.transform.childCount - 1; i >= 0; i--)
{
    Object.Destroy(objParent.transform.GetChild(i).gameObject);
}
Source by forum.unity.com #
 
PREVIOUS NEXT
Tagged: #unity #destroy #child #gameobject
ADD COMMENT
Topic
Name
2+8 =