How to assign a cubemap to material.renderer reflective/diffuse?

Hello,
How do I assign a cubemap to a reflective/diffuse material using a script?

What I mean is this:

32321-image.jpg

Except using code?

I’ve figured it out:

public Texture _MoonShine; // assign the cubemap here. In my case, it's a moonshine cubemap

_material.SetTexture ("_Cube", _MoonShine);

The “_material” variable is a reference to the material that I want to assign the cubemap to. If you want to assign the cubemap to all the materials in an object, do this instead:

public Material[] _materials; // drag all the materials you want the cubemap on, here

public Texture _MoonShine; // your cubemap

for (int i = 0; i < _materials.Length; i++) {
			_materials*.SetTexture ("_Cube", _MoonShine);		*
  •  }*