loading a list of textures that change on mouseUp

Hello All

I have two planes,
one over the other,
and when I click on the first I want there textures to Both change.

I want to be able to choose the different textures by dragging them into the inspector

so I am trying to load the texture based on their variable name plus a counter #, seems pretty straightforward, but I think my syntax is off, see below:

any help is much much appreciated:

// define each plane:
var screen1 : GameObject;
var screen2 : GameObject;

//define all textures for each plane in slots in the inspector
var TextureA_1 : Texture;  
var TextureA_2 : Texture;  
// etc...
var TextureB_1 : Texture;  
var TextureB_2 : Texture;  
//etc...


//define counter
var counter : int;



function Start () {
//zero out
	counter = 0;
}

function Update () {

}


function OnMouseUp () {
	//increase counter
	counter += 1;
	
	//set screen1.texture to go up by 1
	screen1.renderer.material.mainTexture = "TextureA_"+"counter";
	//set screen2.texture to go up by 1
	screen2.renderer.material.mainTexture = "TextureB_"+"counter";
}

Thanks!

~be

You will want to use a pair of arrays to store your textures.

var screen1Textures : Texture[];
var screen2Textures : Texture[];

function OnMouseUp () 
{
	//increase counter
	counter = (counter + 1) % screen1Textures.Length;
	 
	//set screen1.texture to go up by 1
	screen1.renderer.material.mainTexture = screen1Textures[counter];
	//set screen2.texture to go up by 1
	screen2.renderer.material.mainTexture = screen2Textures[counter];
}