Disabling code while panning

I have some code below wich instantiates a cylinder if you click on a collider using “Fire1”. And below that I have som code for the camera that lets me pan up and down, also using “Fire1”.
However while the user is paning up and down I want to dissable the collider instantition code. Becouse its annoying when you start paning over a collider and it instantiates a cyllinder when you really just wanted to pan.

Collider code:

if(Input.GetButtonDown("Fire1"))
	{
	var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    var hit : RaycastHit;
    if (collider.Raycast (ray, hit, 100.0)) 
		{
			var instanceBullet3 = Instantiate(cylinder, transform.position, Quaternion.identity);
		}
	}

Camera Code:

if(Input.GetButtonDown("Fire1"))//pan up and down
	{
		var v : float = verticalSpeed * Input.GetAxis ("Mouse Y");
		transform.position += -transform.up * v;
		CameraMovementBounds();
	}

Hi Jukke

Use Input.GetButtonUp(“Fire1”). Then it should only register the collider hit if you click and not drag the mouse while holding fire1

Thanks for your answer

I actualy tried this. The problem with this solution is that you get the same problem when you stop paning instead of when you start paning.

You could probably check the time it took to press the mouse button and if it is below a certain value like 0.1 seconds make it a click
Something like
float mouseClick;
if(Input.GetButtonDown(“Fire1”)) {
mouseClick = Time.RealTimeSinceStartup;
}
if(Input.GetButtonUp(“Fire1”) Time.RealTimeSinceStartup - mouseClick < 0.1) {
Do some stuff
}
It’s been a long time since I used Input but shouldn’t you use GetButton() instead of GetButtonDown for the panning? As I remember there is a bit of confusion around these two methods.
But I think they fixed it in unity3.4

Tried it and it works fine! thanks!