PasswordField
GUILayout 中的静态方法 | PasswordField |
---|---|
用法 | 生成密码区域 |
用法
public static string PasswordField(string password, params GUILayoutOption[] options);
public static string PasswordField(string password, GUIStyle style, params GUILayoutOption[] options);
public static string PasswordField(string label, string password, params GUILayoutOption[] options);
public static string PasswordField(string label, string password, GUIStyle style, params GUILayoutOption[] options);
public static string PasswordField(GUIContent label, string password, params GUILayoutOption[] options);
public static string PasswordField(GUIContent label, string password, GUIStyle style, params GUILayoutOption[] options);
参数
label
对应的标签名称。
password
密码。
style
(可选)由 GUIStyle
类型定义的 GUI 样式。
options
(可选)用于指定额外的布局属性,该参数将覆盖默认样式。
示例
public override void OnInspectorGUI () {
// password, shown in *
_target.Password = EditorGUILayout.PasswordField("Password", _target.Password);
// actual content of the password
EditorGUILayout.LabelField ("Real Text", _target.Password);
}
编译后如下:
密码区域的文本会显示在下边对应的标签中。