Find child with highest Y transform value,Find child with highest Y value

Hello, I’m making a 2D sorta free runner game. I need a code/function that will allow me to get the children of GO ‘Planets’ and find the one with highest y value as I want to instantiate another GO above the child(my idea for level generator, if you have more efficient ideas that are not timer based pls let me know). Basically I just want to find out which child has the highest Y value. All answers will be much appreciated, thank you.,Hello, I’m making a 2D sorta free runner game. I have a GO named ‘Planets’ and I need a code/function that will allow me to find which child has the highest Y value. I’ll use that to make a level generator so if anyone has more efficient ideas for a level generator that are not timer based, that would also be much appreciated. Thank you guys.

Loop through all children and store the highest y object as you go:

Transform highestChild;
float highestY = -999999;

foreach(Transform child in transform){
     if(child.position.y > highestY){
          highestChild= child;
          highestY= child.position.y;
     }
}