Solution for "get all children of an object unity"

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);

unity get list of children

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

unity get all children

foreach (Transform child in transform)

unity get all children

Similar codes for "get all children of an object unity"


Latest 'C#' questions

Added before "get all children of an object unity"