Renderer.material Manual     Reference     Scripting  
Scripting > Runtime Classes > Renderer

var material : Material


The material of this object.

Modifying material with change the material for this object only.

If the material is used by any other renderers, this will clone the shared material and start using it from now on.

// Set main color to red
renderer.material.color =;

// Change renderer's material each changeInterval
// seconds from the material array defined in the inspector.
var materials : Material[];
var changeInterval = 0.33;

function Update () {
if (materials.length == 0) // do nothing if no materials

// we want this material index now
var index : int = Time.time / changeInterval;
// take a modulo with materials count so that animation repeats
index = index % materials.length;
// assign it to the renderer
renderer.sharedMaterial = materials[index];