search in child of game object and insert theme in to array ?

Hi , how can i search in child of game object and insert theme in to array ?
thanks

You want to put all children of an object into an array? I’d imagine a list would work better, so I’ll give you that code. It should be fairly simple to change this code to an array if you really want.

// This will work if placed on object with children.

public List<GameObject> myList = new List<GameObject>;

void AddChildrenToArray()
{
   foreach (Transform child in transform)
   {
      myList.Add(child)
   }
}