unity foreach child in gameobject code example
Example 1: unity get all children
foreach (Transform child in parent) {
//Your code
}
Example 2: unity foreach child
foreach(Transform child in transform)
{
print(child.gameObject.name)
}
Example 3: get all child gameObject of gameObject C#
foreach (Transform child in transform)