Self-Illuminate on MouseDown

I have a button in my scene which I want to be able to set to light on and off with a mouse click.

However, I have no idea whether it would be possible to change the object shader type from Diffuse to Self-Illumin at run time.

Any ideas if this is possible?

Thanks,

hp

Create a separate material and swap it in at run-time. It should be no problem at all.

Solved this and should be fairly simple. Here is my code in case someone has the same issue.

private var buttonOn = false;

var material : Material; 
var shader : Shader;

function Start () {

}

function Update () {

}

function OnMouseDown() {
	if(!buttonOn) {
		buttonOn = true;
                renderer.material.shader = shader;	
	} else {
		buttonOn = false;
		 renderer.material = material;
	}
}

You have to drag the default shader in the inspector for the Material. The Shader can be selected in the inspector. I chose Self-Illum/Specular.