I know that this might be a commonly asked question but i could not find an answer. How can i make an array of textures and make a gameobject cycle through those textures over time. Any help would be nice.
var textures : Texture2D[];
var delay = 1.0;
private var textureCounter = 0;
function Start () {
InvokeRepeating("CycleTextures", delay, delay);
}
function CycleTextures () {
textureCounter = ++textureCounter % textures.length;
renderer.material.mainTexture = textures[textureCounter];
}
i have attached this script to the gameobject which i wish to change texture but nothing is happening. any ideas why?