Different texture for the same material.

got a bunch of top,pants and gear textures which i want to manually select for each part of my ai’s so they look different and random. But im not sure if i can use 3 materials for say 5 ai’s using different textures for each material.
Here what i got so far - but i got an error "materialTop’ is not a member of renderer.
and so with gear and pants, can somebody help me out and tell me what im doing wrong?

var Top : Texture;
var Pants : Texture;
var Gear : Texture;
var materialTop : Material;
var materialPants : Material;
var materialGear : Material;

function Start () {
renderer.material = materialTop;
renderer.material = materialPants;
renderer.material = materialGear;

renderer.materialTop.mainTexture = Top;
renderer.materialPants.mainTexture = Pants;
renderer.materialGear.mainTexture = Gear;
}

renderer.material can only hold one value (like any variable), which means that the material on your renderer will always be materialGear because it is the last one in the list.

Additionally, the error is correct: there is no such variable under MeshRenderer called materialTop. renderer.materialTop doesn’t exist, it looks like you’re trying to access renderer.material.

However, I think there’s a fundamental problem with how you’re approaching this. Your renderer will only render for one mesh, so you’ll either need separate scripts for each mesh (and therefor each renderer) or you’ll need to have references to each MeshRenderer in this script (gearRenderer:MeshRenderer, etc.).