Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity destroy all children

while (transform.childCount > 0) {
    DestroyImmediate(transform.GetChild(0).gameObject);
}
Comment

Unity Children Destroy

 //put in any gameobject having children and enter playmode
        while (transform.childCount > 0)
        {
            DestroyImmediate(transform.GetChild(0).gameObject);
        }
Comment

unity how to destroy child

//Destroys the first child of the Parent variable
Destroy(Parent.transform.GetChild(0).gameObject);
Comment

Unity Destroy All Children

void Update()
    {
    //put in any gameobject having children and enter playmode
        foreach (Transform child in transform)
        {
            Destroy(child.gameObject);
        }
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: get attribute value of xml element c# 
Csharp :: flip sprite in unity 
Csharp :: c# add string to array 
Csharp :: c# Get all class by namespace 
Csharp :: how to import datagridview to datatable in c# 
Csharp :: unity call function on animation end 
Csharp :: add variable to the beginning of a list c# 
Csharp :: HOW TO RETURN CELL VALUE FROM EXCEL IN C# 
Csharp :: increment operator c# 
Csharp :: update squence c# 
Csharp :: CS0101 
Csharp :: LINQ query to select top 5 
Csharp :: how to work with ascii in c# 
Csharp :: unity audio 
Csharp :: how to duplicate a clip in premiere pro 
Csharp :: recursive reverse linked list 
Csharp :: change color of object unity 
Csharp :: c# if statement 
Csharp :: public tmpro text 
Csharp :: relaycommand 
Csharp :: c# load form 
Csharp :: find how many digits a number has 
Csharp :: c# empty array 
Csharp :: ternary operator c# 
Csharp :: IHttpContextAccessor 
Csharp :: C# network traffic 
Csharp :: c# convert long to int 
Csharp :: Edit file C# 
Csharp :: c# handle single quote inside string 
Csharp :: create new object from generic c# 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =