Material.shader Manual     Reference     Scripting  
Scripting > Runtime Classes > Material
Material.shader

var shader : Shader

Description

The shader used by the material.

// Toggle between Diffuse and Transparent/Diffuse shaders
// when space key is pressed
private var shader1 = Shader.Find( "Diffuse" );
private var shader2 = Shader.Find( "Transparent/Diffuse" );

function Update() {
if( Input.GetButtonDown("Jump") ) {
if( renderer.material.shader == shader1 )
renderer.material.shader = shader2;
else
renderer.material.shader = shader1;
}
}

See Also: Shader.Find method, Materials, ShaderLab documentation.