Game Development Reference
In-Depth Information
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 =;
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
random colors.
Step 5. Modify the Update() function in your code to that in Listing 1.26 .
Search Nedrilad ::

Custom Search