Did you ever wanted to use something like GetDoubleTapButton() ? Yeah, it is not in the unity3D. But I will give you this simple script, that shows how to do it
public class doubleTapExample : MonoBehaviour {
public float tapSpeed = 0.5f; //in seconds
private float lastTapTime = 0;
// Use this for initialization
void Start () {
lastTapTime = 0;
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.W)){
if((Time.time - lastTapTime) < tapSpeed){
Debug.Log("Double tap");
}
lastTapTime = Time.time;
}
}
}
Do you have another solution to do this?
Share it!


