判断GUI双击代码
private var ButtonClicked = false;private var ResetTime = 0.0;
function OnGUI(){
if(GUI.Button(Rect(10,10,80,50), "click me"))
{
ResetTime = Time.time;
if(ButtonClicked)
{
print("It's DoubleClick!");
//EquipItem... and stuff
ButtonClicked = false;
}
else
{
//DisplayItemInfo... and stuff
ButtonClicked = true;
}
}
}
function FixedUpdate()
{
if (ResetTime +0.5 < Time.time)
{
ButtonClicked = false;
}
} 楼主是超人 顶顶多好 难得一见的好帖 很好哦 LZ真是人才 楼主是超人 顶顶多好 真心顶 难得一见的好帖