Pinch Zoom and Input.GetButtonUp

I am using a modified pinch zoom script I found on unity answers. And it is working well to zoom the camera. The problem I have is that I have also set actions to happen on Input.GetButtonUp(“Fire1”).

When I finish zooming the action on buttonup happens as well. Which of course makes good sense since Fire1 does come up. To solve the problem I tried adding a bool value that I set to true when I was zooming then the first buttonup(fire1) i ignore and set the value back to false. However it just plumb doesn’t work.

Anyone have any idea what I need to do to ignore the first buttonup(fire1) after a multitouch (2 finger) sequence?

Thanks

Because you have two fingers down for the pinch there will be two GetButtonUp(“Fire1”) called when you remove your fingers from the screen (it’s unlikely both fingers would be lifted simultaneously). The first time it’s called it will reset your boolean, then the second finger up will cause the action to fire.

I’d set a boolean to pinch zoom when you detect two touches, then when it goes down to one touch start a timer to reset the boolean in 0.5-1.0 sec.