[ SOLVED ]How to make an array of vector 3 positions from child objects

I’m making a Racing style game and am at the process of placing light probes along the length of the track, However placing them by hand is not easy, especially when I have 300 odd track segments. I wanted to make a script to place a light probe at the transform of each track segment (then I can select them all and move them up 1 meter or so).

I can get it to place a light probe at the transform of an object, but I want to select the parent gameobject and for the script to grab every child objects transform and place it into an array. I’ve tried using lists but I don’t know if I’m doing it right.

The LightProbe Group is a component of the parent gameobject.

My script so far looks like this

// Create four probe positions which will form a tetrahedron.

class LightProbePositions extends EditorWindow {

    var lightProbes : LightProbeGroup = null;
    var myobject: GameObject = null;
    var positionarray = new ArrayList();
    @MenuItem ("Examples/Set Probe Positions")
    static function Init () {
        var window = GetWindow (LightProbePositions);
        window.Show ();
    function OnGUI () {
        lightProbes = EditorGUILayout.ObjectField (
            "Find Dependency",
            myobject = EditorGUILayout.ObjectField (
            "Find Dependency",
        if (lightProbes) {
         for (var child : Transform in myobject) {
            if (GUILayout.Button ("Set Probe Positions")) {
                lightProbes.probePositions = positionarray;
        } else {
            EditorGUILayout.LabelField ("Missing:", "Please select an object first!");

Just Create array of Transform Object

Transform[] childs;

then assign value to array using GetComponentsInChildren method of gameObject with parameter value

object will return array of all transform object of self at index 0 and children’s starting from index 1