Double touch on mobile, simple way?

Hi,

i have some issues to understand how we can get a double tap on mobile (android).
The code from the complete project of Penelope works fine, but it is more about a “long touch” rather than a double touch.
I have tried the code from this thread (How does multi-touch work - Questions & Answers - Unity Discussions), but it does not work :

	var count = Input.touchCount;
	
	
	/* 1/ DOES NOT WORK:
	var tt : Touch;
	var tcount = tt.tapCount;
	
	if (tcount==1) Debug.Log("______!!!!!!!!!!!!!!!______________");
	else if (tcount==2) animation.CrossFade("newAnim");*/
	
	
	
	/* 2/ ONLY SAYS count == 1, never count == 2*/
	if (count!=0){
		
		Debug.Log("________ count EQUALS :::::: _________"+count);
		
		var tapCount = Input.touchCount;
		if(tapCount > 1) {
			animation.CrossFade("newAnim");
		}
		
		for(var i : int = 0;i < count; i++)
		{
			if (i==0) Debug.Log("________ i EQUALS ZERO_________");//always shows this one
			else if (i==1) Debug.Log("________ i EQUALS OOONNNNEEE_________");//never this one
		}
	}

I tried to modify the code from “Penelope”, but i guess i have to be very careful with the time elapsed between 2 touches :

if (count!=0){
		
		for(var i : int = 0;i < count; i++)
		{
			Debug.Log("__ME : _____i : "+i);
			// Adjust the tap time window while it still available
			if ( tapTimeWindow > 0 )
				tapTimeWindow -= Time.deltaTime;
			else
				tapCount = 0;
				
			// Accumulate taps if it is within the time window
			if ( tapTimeWindow > 0 )
				tapCount++;
			else
			{
				tapCount = 1;
				tapTimeWindow = tapTimeDelta;
			}
		}
		
		if (tapCount==2){
			Debug.Log("__ME : _____if tapCount==2 YES");
			animation.CrossFade("newAnim");
		}
		
	
	}

Would anyone know why the first code does not work? And if there is a simple solution to get the double touch, instead of calculating the time between 2 touches?


EDIT:

I have tried this one, but i never get more that “one” touch, so it stays at “GetTouch(0)” even when i double tap on the screen :

var count = Input.touchCount;
	
	if (count!=0){
		
		for(var i : int = 0;i < count; i++)
		{
			if (Input.GetTouch(i).phase == TouchPhase.Began) Debug.Log("______GetTouch("+i+") !!!______________");
		}
	}

Thanks

for (var touch in Input.touches) {
if (touch.tapCount == 2) {
// double-tap
}
}