Event


Event:
UnityGUI 事件.

事件对应于用户输入(按键和鼠标操作),或者是UnityGUI layout or rendering events。

For each event OnGUI is called in the scripts; so OnGUI is potentially called multiple times per frame. Event.current corresponds to "current" event inside OnGUI call.
每一次事件发生,OnGUI被调用一次。所以在每一帧中,OnGUI可能被调用多次。在OnGUI中,Event.current对应于当前发生的事件。
void OnGUI()
    {
        Event e = Event.current;
        if ( e.isMouse && e.type == EventType.MouseDown && e.clickCount == 2)
        {
            print("Double Click");
        }
    }
    

你可能感兴趣的:(Event)