Crosshair when holding RMB

I have a script like that

var Texture : Texture2D;
function OnGUI () 
{    
    GUI.DrawTexture(Rect ((Screen.width/2)-(Texture.width/2), (Screen.height/2)-Texture.height/2), Texture.width, Texture.height), Texture);
}

How do I change it, so when I hold right mouse button the crosshair shows up, and when I don’t hold RMB, this crosshair won’t show? Because when I’m not zoomed in while using this script, it still shows he crosshair.

Use Input.GetMouseButton():

var Texture : Texture2D;
function OnGUI () 
{   
	if (Input.GetMouseButton(1))
        GUI.DrawTexture(Rect((Screen.width/2)-(Texture.width/2), (Screen.height/2)-(Texture.height/2), Texture.width, Texture.height), Texture);
}

Thanks :slight_smile: