Copy Childen Of GameObjects From Array 1 To Array 2

Alright, so I am attempting to take a smaller array that contains a few parent objects, and have a second smaller array go through and grab all of the children objects from the parent objects in the first array. However, this script is only grabbing the children objects from the LAST parent object in the smaller array.

Does “for (int i = 0; i < short_array.Length; i++)” not go through and consider every parent object in the smaller array until it reaches the end of the array? Or does it only call the last parent in the smaller array?

What about this exactly am I overlooking, because I am calling on other arrays using “for (int i = 0; i < array.Length; i++)” and it goes through every object in those instances, not just the last one.

public RectTransform[] short_array;
	public RectTransform[] long_array;
	
	public void FindArrayChildren()
	{
		for (int i = 0; i < short_array.Length; i++)
		{
			long_array = short_array*.gameObject.GetComponentsInChildren<RectTransform>(includeInactive: true);*
  •  }*
    

}

you need 2 for, one to set the current position of the childs array, and other to know the parent. Your code is just making your long_array to be equal to every child object of every parent. Just equal, for every new parent you override the previous array of long_array. The best solution, if you dont know the length of the long_array, could be using a list