Answers for "unity detect mouse double click with input"

C#
0

unity detect mouse double click with input

private float lastClickTime;

public float catchTime = 0.25f;

void Update ()
{

    if(Input.GetButtonDown("Fire1"))
    {
        if(Time.time - lastClickTime < catchTime)
        {
            //double click
            print("Double click");
        }
        else
        {
            //normal click
        }
        lastClickTime = Time.time;
    }
}
Posted by: Guest on May-19-2021

Code answers related to "unity detect mouse double click with input"

C# Answers by Framework

Browse Popular Code Answers by Language