Editor模式下的控件没有提供直接检测双击的消息,但可以简单模拟出双击检测的效果,代码如下所示:
private double clickTime = 0f; ... if (GUILayout.Button("TestButton")) { if(EditorApplication.timeSinceStartup - clickTime < 0.3f) { OnDoubleClick(pair.Value); } else { OnClick(pair.Value); } clickTime = EditorApplication.timeSinceStartup; }