-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Unity Android Game Development by Example Beginner's Guide
By :
There is just one thing left to do, and then we will be done with materials and can go on to make the game even more fun. Remember the Offset value of the materials? It turns out that we can actually control that with a script. Start by opening up the ChassisControls script.
First, we need to add a few variables to the beginning of the script. The first two will hold references to our tank tread renderers, the part of the mesh object that keeps track of the material that is applied to the mesh and actually does the drawing. This is just like how the characterControl variable holds a reference to our CharacterController component.
public Renderer rightTread; public Renderer leftTread;
The second two variables will keep track of the amount of offset applied to each tread. We store it here because it is a faster reference than trying to look it up from the thread's material each frame.
private float rightOffset = 0; private float leftOffset = 0;
To make use of the...
Change the font size
Change margin width
Change background colour