Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity get all children

foreach (Transform child in parent) {
  //Your code
}
Comment

unity get list of children

List<Transform> children = new List<Transform>(transform.GetComponentsInChildren<Transform>());
//!!!!DISCLAMER!!!! This will also include the parent object for whatever reason.
//Heres a less elegant solution that wont include parent:
List<Transform> children = new List<Transform>();
foreach (Transform tr in transform) children.Add(tr);
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# loop string array 
Csharp :: how to write int array to console c# 
Csharp :: unity object change sprite 
Csharp :: newtonsoft create dynamic object 
Csharp :: add dependency injection .net core console app 
Csharp :: c# datagridview cell click event 
Csharp :: how to save datagridview data to database in c# windows application 
Csharp :: linq from select 
Csharp :: unity c# foreach 
Csharp :: dynamic arrays in c# 
Csharp :: Play Sound c# 
Csharp :: c# move files from one directory to another 
Csharp :: list.max c# 
Csharp :: c# reflection resize array 
Csharp :: when was the third world war 
Csharp :: c# byte 
Csharp :: c# connect tcp 
Csharp :: c# multiline comment 
Csharp :: read excel to object c# 
Csharp :: c# select oracle database 
Csharp :: asp.net core get previouse url 
Csharp :: split string on last element 
Csharp :: array join c# 
Csharp :: unity editor script 
Csharp :: c# clear all textboxes 
Csharp :: how use unity interfaces 
Csharp :: how to make button in asp.net to go to other page 
Csharp :: get color of pixel c# 
Csharp :: unity image 
Csharp :: How to make game object transparent in unity 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =