Rotate Object On Mouse Click

I need to rotate a 3D object 90 degrees when the player clicks on it. This is the current script I have attached to my 3D object. Unfortunately nothing happens when I click on the 3D object.

function OnMouseClick ()    {
transform.rotate(90);
}

Any help is greatly appreciated. Thank you.

I don’t think OnMouseClick is a legitimate event. You probably want OnMouseDown.

edit
Actually, you should use:
http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnMouseUpAsButton.html

It works on GameObjects which have GUIElement or Collider components.

So i need same action! I’ve got a plane I want rotate the plane on 90 on mouse click! How to do it?

How to rotate the plane on 90gr. on mouse down?

Try this:

function OnMouseOver(){
  if(Input.GetMouseButtonDown(0)){
      transform.Rotate(new Vector3(0,90,0));
  }
}

It works for me.

I could be wrong but I think that OnMouseDown only applies to GUITextures, so what I suggest is a raycast:

#pragma strict
var range : 50;
var hittag : String = "plane";

function Update(){

//raycast vars
var direction = transform.TransformDirection(Vector3.forward);
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit : RaycastHit;

if(Physics.Raycast(ray, hit, range)){
    if(hit.transform.tag == hittag){
	   hit.transform.rotation = Vector3(0, 90, 0);
	   //or you can use:
	   //hit.transform.Rotate untill its reached 90

   }

}

}

Good luck!

-Hybris

You are wrong Hybris. You can simply use:
function OnMouseDown ()