How to get the objects inside another object and put them in a array?

Im making a 3D fps game called “Tactical Warfare
And right now im trying to add attachments,
but i need to find gameobjects that are in another gameobject
and put the in an array.

heres my current script im trying to do it
and primarySightsPath is a Transform.

if(Input.GetKeyDown("j")){
	primarySightsPath = GameObject.Find(primaryGunObj.name + "Gun Animation Parent/Attachments/Slider/Sights").transform;
    for(var attach : Transform in primarySightsPath){
    	primarySights.Push("attach.gameObject");
    }
   }

I figured out a better way of doing a attachments system but if any one wants me to show them the code just leave a comment or something.