验证特殊命令(例如复制和粘贴)。
"复制"、"剪切"、"粘贴"、"删除"、"选中帧"、"复制"、"全选"等等。仅在编辑器中发送。
示例:使粘贴在当前窗口或控件中工作
using UnityEngine; using UnityEditor;
public class Example : MonoBehaviour { void OnGUI() { //implement frame selection Event e = 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); } } }