Game Development Reference
In-Depth Information
Figure 11-30. Experimenting with the x Offset value
2.
In the Laser Beam material, try adjusting the x Offset by .2 or .5 to see the
texture shift.
3.
Create a new C# Script in the Game Scripts folder.
4.
Name it UVAnimator .
5.
Open it in the script editor.
6.
Add the following variables:
public int materialIndex = 0; // in case the object has more than one material
public Material theMaterial; // the object's material[s]
public bool animateUV = true; // flag for option to scroll texture
public float scrollSpeedU1 = 0.0f; // variables to scroll texture
public float scrollSpeedV1 = 0.0f;
public bool animateBump = false; // flag for option to scroll bump texture
public float scrollSpeedU2 = 0.0f; // variables to scroll bump texture
public float scrollSpeedV2 = 0.0f;
In the Start function, you will assign the material so it will be available throughout the rest of the game.
Add the following to the Start function:
7.
theMaterial = renderer.materials[materialIndex];
 
Search WWH ::




Custom Search