public void SetMaterials(int bodyindex, int eyesindex) { BodySkin= (skinselect) bodyindex; EyesSkin= (eyesselect) eyesindex; foreach (SkinnedMeshRenderer element in rend) { element.materials[0].mainTexture = skin[bodyindex]; if(element.materials.Length>1) element.materials[1].mainTexture = eyes[eyesindex]; } }