Event.commandName 命令名称

var commandName : string

Description描述

The name of an ExecuteCommand or ValidateCommand Event

ExecuteCommand或ValidateCommand事件的名字。

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

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

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnGUI() {
		Event e = Event.current;
		if (e.commandName != "")
			Debug.Log("Command recognized: " + e.commandName);

	}
}
// Detects commands executed and prints them.
//检测执行的命令,并打印
function OnGUI() {
	var e : Event = Event.current;
	if(e.commandName != "") {
		Debug.Log("Command recognized: " + e.commandName);
	}
}
最后修改:2010年12月31日 Friday 16:36

本脚本参考基于Unity 3.4.1f5

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