hey all
I know this subject is discussed many times, but im actually not finding my answer, so i decided to post this.
i’m writing a script to detect the doubleClick of a mouse inside the Update() function
so far i have reached this
protected float doubleClickDelay = 0.2f,previousClick = 0f;
void Update(){
//.....
if(Input.GetMouseButtonDown(0) ){
float gap = Time.time - previousClick;
if( gap < doubleClickDelay ){
Debug.Log("DC");
}else{
Debug.Log("not DC");
detectObjectSelection();
}
previousClick = Time.time;
}
//....
when im debugging it, the mouse actually detects the double Click, but here is the problem
when im single clicking, i get “notDC”
when im double clicking , i get “not DC” and “DC”
the first click is always accessible in the script whether its one/two clicks
I cant use this script inside the onGUI() function, therefore i cant use the Event class to detect the .clickCount.
my question is how to eliminate the “notDC” in the double Clicking ?