x


referring to a particular material

I am wanting an objects texture to cycle through over time and I have this working on objects with only one material attached but need it to work on an object which has more than one material. How do i refer to the particular material? It won't allow me to use

renderer.material[0].mainTexture

This is the entire script:

var textures : Texture2D[];

var delay = 1.0; var textureCounter = 0;

function Start () { InvokeRepeating("CycleTextures", delay, delay); }

function CycleTextures () { textureCounter = ++textureCounter % textures.length; renderer.material(0).mainTexture = textures[textureCounter]; }

thankyou

more ▼

asked Nov 16 '11 at 10:58 AM

mehowe7 gravatar image

mehowe7
31 15 15 17

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2277
x841
x588
x389

asked: Nov 16 '11 at 10:58 AM

Seen: 977 times

Last Updated: Nov 16 '11 at 10:58 AM