Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity put children in list

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);
 
PREVIOUS NEXT
Tagged: #unity #put #children #list
ADD COMMENT
Topic
Name
1+6 =