EventType.ValidateCommand

切换到手册

描述

验证特殊命令(例如复制和粘贴)。

"Copy"、"Cut"、"Paste"、"Delete"、"FrameSelected"、"Duplicate"、"SelectAll" 等。 仅在该 Editor 中发送。

示例:在当前窗口或控件中执行粘贴工作:

    function OnGUI()
    {
        var e:Event = Event.current;

if (e.type == EventType.ValidateCommand && e.commandName == "Paste") { Debug.Log("validate paste"); e.Use(); // without this line we won't get ExecuteCommand }

if (e.type == EventType.ExecuteCommand && e.commandName == "Paste") { Debug.Log("Pasting: " + EditorGUIUtility.systemCopyBuffer); } }