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);
	}
}
Page last updated: 2010-12-31