change a material from multiple materials

Hello everyone,
I’ve got a problem with changing a material on an object which has multiple materials (2)

renderer.material = Off; (WORKS it changes the first material)

renderer.materials[0] = Off; (Doesn’t change any material)

<= this is what I’m looking for , choosing what material in the list I want to change , but it doesn’t work !
How can I do ?
Thanks for reading

has an awnser.

var materials : Material = mesh.renderer.materials;

materials[0] = crateMat1snow;

mesh.renderer.materials = materials;

That works but generates a unity error:

Instantiating material due to calling renderer.material during edit mode. This will leak materials into the scene. You most likely want to use renderer.sharedMaterial instead.
UnityEngine.Renderer:get_materials()
in unity 3.5