Double click events

How to display double click events in GUI.Label when user click on the screen how to display how single or double click on gui.label

   function OnGUI() 
   {
   var e : Event = Event.current;
   if (e.isMouse) 
   {
   GUI.Label (Rect (10, 10, 150, 20),"Mouse clicks: " +e.clickCount );
   print("Mouse clicks: " + e.clickCount);
   }

   }

Well, to detect a double click do that:

// UnityScript
function OnGUI() 
{
    var e : Event = Event.current;
    if (e.isMouse && e.type == EventType.MouseDown && e.clickCount == 2)
    {
        // Double click event
        Debug.Log("Double click");
    }
}

i made this for double-click actions. Contributing →

  if(DoubleClick()){
    //do something..
  }

float clicked = 0;
float clicktime = 0;
float clickdelay = 0.5f;

bool DoubleClick(){
		if (Input.GetMouseButtonDown (0)) {
			clicked++;
			if (clicked == 1) clicktime = Time.time;
		} 		
		if (clicked > 1 && Time.time - clicktime < clickdelay) {
			clicked = 0;
			clicktime = 0;
			return true;
		} else if (clicked > 2 || Time.time - clicktime > 1) clicked = 0; 		
		return false;
	}

using UnityEngine;
using System.Collections;
using UnityEditor;

public class TestEditorWindow : EditorWindow {
	[MenuItem("nima/hehhe")]
	static void HEHE()
	{
		GetWindow <TestEditorWindow>().Show ();
	}
	double lastdoubleClicktime;
	void OnGUI()
	{
		if (Event.current != null && Event.current.clickCount == 2) {
			lastdoubleClicktime = EditorApplication.timeSinceStartup;
		}
		if (GUILayout.Button("TEST")) {
			if (EditorApplication.timeSinceStartup - lastdoubleClicktime < .8f) {
				Debug.Log ("I think this is a double click");
			} 
	}

}

void OnGUI ()

{

   Event Mouse= Event.current;
         if (Mouse.clickCount == 2)
         {
           
            print("Double Click");
           
         }
 }

bool mouseClicksStarted = false;
int mouseClicks = 0;
float mouseTimerLimit = .25f;

public void OnClick(){
	mouseClicks++;
	if(mouseClicksStarted){
		return;
	}
	mouseClicksStarted = true;
	Invoke("checkMouseDoubleClick",mouseTimerLimit);
}

 
private void checkMouseDoubleClick()
{
	if(mouseClicks > 1){
		Debug.Log("Double Clickedd");
		
	}else{
		Debug.Log("Single Clicked");
		
	}
	mouseClicksStarted = false;
	mouseClicks = 0;
}