Answers for "unity get list of childrens"

C#
1

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);
Posted by: Guest on August-12-2021
8

unity get all children

foreach (Transform child in transform)
Posted by: Guest on March-22-2020

C# Answers by Framework

Browse Popular Code Answers by Language