Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity delete all children

 foreach (Transform child in transform) {
     Destroy(child.gameObject);
 }
Comment

unity destroy all children

while (transform.childCount > 0) {
    DestroyImmediate(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 :: asp.net data annotations email 
Csharp :: minimize button c# 
Csharp :: dropdown text mesh pro unity 
Csharp :: how to restart a scene in unity 
Csharp :: unity create random string 
Csharp :: unity rotation between 2 points 
Csharp :: wpf round button 
Csharp :: c# replace all non numeric characters 
Csharp :: unity key detection 
Csharp :: c# random int 
Csharp :: get date of tomorrow c# 
Csharp :: c# replace crlf 
Csharp :: unity mouse position to world 
Csharp :: how to detect collision in unity 
Csharp :: string to int c# unity 
Csharp :: c# count files in directory and subdirectories 
Csharp :: unity android quit application 
Csharp :: linux command line exit with error message 
Csharp :: make an enemy go towards player unity 
Csharp :: unity why is there no transform.left 
Csharp :: unity add component 
Csharp :: asp core asp for not working 
Csharp :: c# difference between break and continue 
Csharp :: c# insert into database 
Csharp :: c# ip address translate localhost 
Csharp :: unity movetowards 2d 
Csharp :: OnCollision update unity 
Csharp :: unity convert mouse position to world position in editor mode 
Csharp :: unity c# timer 
Csharp :: why vue cli do not refresh auto in local host 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =