Here's how. Just use an array of materials and cycle through them with each successive mouse click. Then apply your newly chosen material to your mesh and your good! So like this:
var matArray : Material[];
private var index : int;
function Update () {
if (Input.GetButtonDown("Fire1")) {
index++;
index = index % matArray.Length;
renderer.material = matArray[index];
}
}
Add your materials to matArray and ensure this script is attached to the mesh you want to affect. :)
Hope that helps, Klep
↧