noob question - material isn't changing from script

var first : Texture;
var second : Texture;
function Update() {
this.renderer.material.mainTexture = first;
this.renderer.material.mainTexture = second;

I’m trying to change a cube’s texture from a script . It’s meant to keep changing from one to the other while the game’s playing , but nothing happens ??? I’m kinda expecting it to go from on to the other and back . How do I make it do this?

doing it in update will make it change every frame so it might just be too fast

function Start () {

function MatLoop (speed : float) {

		renderer.material.mainTexture = first;

		yield WaitForSeconds(speed);
		renderer.material.mainTexture = second;
		yield WaitForSeconds(speed);