Game Development Reference
In-Depth Information
Step 11. Play. Note that the new cube behaves in the same way as the
sphere. This is because the script in spherePhysics applies itself to the
object to which it is attached. As a result, the cube turns red and falls
with the same physics attributes at the sphere. Generic script like this
can be added to any game object.
Step 12. Because the myColor variable is exposed, it can be changed
in the Inspector before playing. Select the cube from the Hierarchy
and change myColor in the Inspector to green.
Step 13. Play. Note that the sphere remains red but the cube is now
green. Both are using the same script but different versions of it.
You could also expose the variable for the bounciness and set it to
different values for the sphere and cube in the Hierarchy, as shown in
Listing 1.31 .
Listing 1.31 Exposing a Variable for Bounciness
var myColor: Color =;
var bouncyAmount: float = 0.5;
function Start()
var material = new PhysicMaterial();
material.bounciness = bouncyAmount;
this.collider.material = material;
this.renderer.material.color = myColor;
Bounciness in the physics engine is a float that only takes values between
0 and 1 where 0 is not bouncy and 1 is fully bouncy.
1.6 A Game Art Asset Primer
This primer will not teach you how to create game assets. Such topics are
topics on their own. It will, however, point you in the right direction to get
started creating your own assets, as well as where to find already made ones.
Most importantly, this primer will introduce you to the different types of
assets and how to get them into a Unity game.
Search Nedrilad ::

Custom Search