- Home /
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
Your answer
Follow this Question
Related Questions
Best option to change texture/material.. 0 Answers
How to switch texture of several 3D objects on GUI buttons click? 1 Answer
How to create a GUI button to change a character's texture in real-time? 2 Answers
Changing / Adding Material over Real-World Time 0 Answers
Cost of changing texture 0 Answers