Good day. Work with Unity. When clicking, the if-else condition is called. Can you please tell me how to make the condition be met if less than 3 seconds elapse between two clicks? Something I can not figure out how to do it. Thank.

    1 answer 1

     float lastTime; void Update() { if (Input.GetMouseButtonDown(0)) { if (Time.realtimeSinceStartup - lastTime > 3f) { MyAction(); lastTime = Time.realtimeSinceStartup; } } }