Issue with Texture Change

var textureOne : Texture2D;
var textureTwo : Texture2D;

InvokeRepeating("Change", 0, 1);

function Start () {
renderer.material.mainTexture = textureOne;
}

function Change () {
if(renderer.material.mainTexture == textureOne){
	renderer.material.mainTexture = textureTwo;
}

if(renderer.material.mainTexture == textureTwo){
	renderer.material.mainTexture = textureOne;
}
}

No errors or anything, the texture just doesnt change.

Can someone point me in the right direction? I just need the texture to change every “x” seconds.

Hi, you will need to use a else if statement for second if. You are applying texture two the reapplying texture one again.

if(renderer.material.mainTexture == textureOne)
    renderer.material.mainTexture = textureTwo;
else if(renderer.material.mainTexture == textureTwo)
    renderer.material.mainTexture = textureOne;