- Home /
TapCount doesn't work... why not?
Hi,
I'm trying to create a double tap feature but I never get more than 1 tap.
I have:
void Update(){
if (Input.TouchCount == 1) { //To make sure only one finger does the dTap
Debug.Log("ONE TAP");
if(Input.GetTouch(0).tapCount == 2) Debug.Log("DOUBLE TAP");
}
} // End Update
I tried that on my Samsung Galaxy Tab 2 and I only get two "ONE TAP"s in the debug log. What I mean is that it gives me two ONE TAP messages and not a DOUBLE TAP message.
I can get the tapCount to count more than one. What am I doing wrong?. Maybe this doesn't work in Android.. does anyone know?
Thanks for your time!
Answer by iagofg · May 23, 2013 at 03:43 PM
It only works in iOS, on Android it is always 1:
http://docs.unity3d.com/Documentation/Manual/Input.html
on section: Mobile Input.
tapCount: the iPhone/iPad screen is able to distinguish quick finger taps by the user. This counter will let you know how many times the user has tapped the screen without moving a finger to the sides. Android devices do not count number of taps, this field is always 1.
Answer by liyokikon · Jul 03, 2014 at 08:56 AM
if (Input.touchCount > 0) {
Debug.Log("ONE TAP");
if(Input.GetTouch(0).tapCount == 2)
Debug.Log("DOUBLE TAP");
}