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

var enabled : bool

Description

Makes the rendered 3D object visible if enabled.

// make the object invisible
renderer.enabled = false;

// make the object visible
renderer.enabled = true;

// toggle object's visibility each second
function Update () {
// Find out whether current second is odd or even
var seconds : int = Time.time;
var oddeven = (seconds % 2) == 0;
// Enable renderer accordingly
renderer.enabled = oddeven;
}