right mouse down on a gameObject

Hey, so here's something I'm trying to figure out. I have two boxes in a scene that I want to rotate when the right button is held down on each box and dragged left and right. so moving the mouse left would make the object rotate one direction and vice versa.. I've kinda figured out how to do this using the left mouse button. problem is I don't know what to use for "onMouseDown" and "onMouseUp" when using the right mouse button.. I can simply use if(Input.GetMouseButtonDown(1)){} but this wouldn't detect if the mouse is on the object.... any help would be greatly appreciated, thanks!

You can use "OnMoseOver" that is something like "Update" but it's called only when the pointer is over the object:

function OnMouseOver () 
{
    if(Input.GetMouseButtonDown(0))
        Debug.Log("Left click on this object");
    if(Input.GetMouseButtonDown(1))
        Debug.Log("Right click on this object");
    if(Input.GetMouseButtonDown(2))
        Debug.Log("Middle click on this object");
}

Here's a complete solution for right click detection: http://blog.gfx47.com/2011/04/04/detect-right-click-on-game-objects-in-unity3d/ Hope that will help! ;)