Game Development Reference
aP[i] = GameObject.
aP[i].transform.position.y = i + 1;
function Update ()
for(var i:int = 0; i < 9; i++)
aP[i].renderer.material.color = Color.red;
Fig 1.31 A stack of colored cubes
created entirely with script.
Step 4. Save and play. The cubes created will have turned red. If you
want to keep the cubes red, the code in the Update() function of
Listing 1.25 would be better served inside the bottom of Start() as
there would be no need to keep setting them to red in each main
loop. However, we are now going to modify them to change to
Step 5. Modify the Update() function in your code to that in Listing 1.26 .