code to access submesh materials 1,2,3,4 etc?

A woman has various submeshes to make her eyes, hair, etc. i can only select the entire woman, and all the materials are on her GameObject, and i would like to know how to access her different materials, to color them, i.e. hair, eyes, cardigan, laces, etc.

Here’s an example for setting a texture on the mesh, and let’s say the material slot is 4 (UnityScript):

var yourTextureHere : Texture2D;

GameObject.renderer.materials[4].SetTexture("_MainTex", yourTextureHere);

Here’s how to use color in RGB format instead of a texture (UnityScript):

// assuming you want to color the material with the RGB value 128,255,60...

var r : int = 128;
var g : int = 255;
var b : int = 60;

GameObject.renderer.materials[4].SetColor ("_Color", Color(r/255.0, g/255.0, b/255.0));