Answers for "how to detect double tap in unity"

0

how to detect double tap in unity

var tapping : boolean;
var LastTap : float;
var tapTime : float;
 
 
function Update(){
if(Input.GetKeyDown("f")){
if(!tapping){
tapping = true;
SingleTap();
}
if((Time.time - LastTap) < tapTime){
Debug.Log("DoubleTap");
tapping = false;
}
LastTap = Time.time;
}
}
 
function SingleTap(){
yield WaitForSeconds(tapTime);
if(tapping){
Debug.Log("SingleTap");
tapping = false;
}
}
Posted by: Guest on March-13-2021

Code answers related to "how to detect double tap in unity"

Browse Popular Code Answers by Language