Game Development Reference
In-Depth Information
sphere.renderer.material =
sphere.renderer.material.shader = Shader.
Step 22. With the main camera selected in the Hierarchy, locate the
spawn script. Click on the small triangle next to Material Array to
expose the array values. Set the Size to 4. For each of the elements
that appear, drag and drop the blue, green, red, and yellow materials
into the locations as shown in Figure 4.5 .
Fig 4.5 Adding materials to an array
in a script.
Step 23. Play. Each ball that falls will be assigned a random color. The
colors are picked out of the array using the same Random.Range()
function used for the spawn timing.
The next step involves moving balls with the mouse. The coding for
this is not as simple as it might sound. Therefore, this hands-on session
will be placed on hold to provide you with some essential background
Search Nedrilad ::

Custom Search