EventType.ValidateCommand 验证命令

EventType.ValidateCommand

Description描述

Validates a special command (e.g. copy & paste)

验证一个特殊的命令(如,拷贝,粘贴)。

"Copy", "Cut", "Paste", "Delete", "FrameSelected", "Duplicate", "SelectAll" and so on. Sent only in the editor.

"Copy", "Cut", "Paste", "Delete", "FrameSelected", "Duplicate", "SelectAll"等等,仅发送于编辑器。

Example: Make pasting work in current window or control:

例如:在当前窗口粘贴或控制:

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
		//没有此行,我们不会得到ExecuteCommand
	}

	if (e.type == EventType.ExecuteCommand && e.commandName == "Paste")
	{
		Debug.Log("Pasting: " + EditorGUIUtility.systemCopyBuffer);
	}
}
最后修改:2011年5月9日 Monday 14:42

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。