Introduction

AidTech is 2D sci-fi action adventure with focus on the story. Main elements of this game are your decisions - with them you influence the game. So your decisions will matter. You use teleportation, laser weapons and energetic shields to your advantage. You will come through research complexes, space ships, and remains of civilization scattered in the universe to save what is most important for you. Read more about AidTech

Double tap button Unity3D

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!