直接把这段代码放在你需要双击的物体身上
using UnityEngine;
using System.Collections;
using System;
// 直接拖到需要双击的物体身上//
public class DoubleClickRotate : MonoBehaviour {
DateTime t1,t2;
int i=1;
// Use this for initialization
void Start () {
t1=DateTime.Now;
}
// Update is called once per frame
void Update () {
}
void OnMouseDown(){
Debug.Log("单击事件");
if(i==1) {
t2=DateTime.Now;//系统当前的时间//
if(t2-t1<new TimeSpan(0,0,0,0,200))
{
Debug.Log("双击事件");
}
t1=t2; }
}
}