static var actionKey : bool
Description描述
Is the platform-dependent "action" modifier key held down? (Read Only)
有平台相关的”action”修改键被按下?(只读)
The key is Command on Mac OS X, Control on Windows.
Mac OS X上为Command键,Windows上为Control (ctrl)键。
Action Key usage, key not pressed/key pressed.
动作键的用法,键按没按下/按下。
// Shows a password field with some "hidden" text.
//显示密码文本框,具有一些隐藏文本
// When the user presses the action key the password field becomes a text field.
//当用户点击action key,密码文本框转变为普通文本框
class EditorGUIActionKey extends EditorWindow {
var text : String = "This is some text";
@MenuItem("Examples/Show Hide password")
static function Init() {
var window = GetWindow(EditorGUIActionKey);
window.position = Rect(0, 0, 250, 60);
window.Show();
}
function OnGUI() {
// Show the contents 显示内容
if(EditorGUI.actionKey) {
text = EditorGUI.TextField(Rect(0, 5, 245, 20), "Shown Text:", text);
} else {
// show the pasword field 显示密码文本框
text = EditorGUI.PasswordField(Rect(0, 5, 245, 20), "Hidden Text:", text);
}
if(GUI.Button(Rect(0,30, 250, 20),"Close"))
this.Close();
}
function OnInspectorUpdate() {
Repaint();
}
}