private IEnumerator ClickEvent() { //pause a frame so you don't pick up the same mouse down event. yield return(new WaitForEndOfFrame()); float count = 0f; while (count < doubleClickTimer) { if (Input.GetMouseButtonDown(0)) { Vector3 pos = transform.position; cameraScript.StartCoroutine(cameraScript.CameraJump(pos)); yield break; } count += Time.deltaTime; // increment counter by change in time between frames yield return(null); // wait for the next frame } }