UnityEditor.EditorGUILayout.PasswordField C# (CSharp) Method

PasswordField() public static method

Make a text field where the user can enter a password.

public static PasswordField ( GUIContent label, string password ) : string
label UnityEngine.GUIContent Optional label to display in front of the password field.
password string The password to edit.
return string
        public static string PasswordField(GUIContent label, string password, params GUILayoutOption[] options)
        {
            return PasswordField(label, password, EditorStyles.textField, options);
        }

Same methods

EditorGUILayout::PasswordField ( GUIContent label, string password, GUIStyle style ) : string
EditorGUILayout::PasswordField ( string password ) : string
EditorGUILayout::PasswordField ( string password, GUIStyle style ) : string
EditorGUILayout::PasswordField ( string label, string password ) : string
EditorGUILayout::PasswordField ( string label, string password, GUIStyle style ) : string

Usage Example

        public void OnGUI()
        {
            if (AssetStoreLoginWindow.styles == null)
            {
                AssetStoreLoginWindow.styles = new AssetStoreLoginWindow.Styles();
            }
            AssetStoreLoginWindow.LoadLogos();
            if (AssetStoreClient.LoginInProgress() || AssetStoreClient.LoggedIn())
            {
                GUI.enabled = false;
            }
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.Label(AssetStoreLoginWindow.s_AssetStoreLogo, GUIStyle.none, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            });
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(6f);
            GUILayout.Label(this.m_LoginReason, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
            Rect lastRect = GUILayoutUtility.GetLastRect();

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(6f);
            Rect lastRect2 = new Rect(0f, 0f, 0f, 0f);

            if (this.m_LoginRemoteMessage != null)
            {
                Color color = GUI.color;
                GUI.color = Color.red;
                GUILayout.Label(this.m_LoginRemoteMessage, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
                GUI.color = color;
                lastRect2 = GUILayoutUtility.GetLastRect();
            }
            float num = lastRect.height + lastRect2.height + 110f;

            if (Event.current.type == EventType.Repaint && num != base.position.height)
            {
                base.position = new Rect(base.position.x, base.position.y, base.position.width, num);
                base.Repaint();
            }
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUI.SetNextControlName("username");
            this.m_Username = EditorGUILayout.TextField("Username", this.m_Username, new GUILayoutOption[0]);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.m_Password = EditorGUILayout.PasswordField("Password", this.m_Password, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true)
            });
            if (GUILayout.Button(new GUIContent("Forgot?", "Reset your password"), AssetStoreLoginWindow.styles.link, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            }))
            {
                Application.OpenURL("https://accounts.unity3d.com/password/new");
            }
            EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
            GUILayout.EndHorizontal();
            bool rememberSession = AssetStoreClient.RememberSession;
            bool flag            = EditorGUILayout.Toggle("Remember me", rememberSession, new GUILayoutOption[0]);

            if (flag != rememberSession)
            {
                AssetStoreClient.RememberSession = flag;
            }
            GUILayout.EndVertical();
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.Space(8f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            if (GUILayout.Button("Create account", new GUILayoutOption[0]))
            {
                AssetStore.Open("createuser/");
                this.m_LoginRemoteMessage = "Cancelled - create user";
                base.Close();
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Cancel", new GUILayoutOption[0]))
            {
                this.m_LoginRemoteMessage = "Cancelled";
                base.Close();
            }
            GUILayout.Space(5f);
            if (GUILayout.Button("Login", new GUILayoutOption[0]))
            {
                this.DoLogin();
                base.Repaint();
            }
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
            GUILayout.EndVertical();
            if (Event.current.Equals(Event.KeyboardEvent("return")))
            {
                this.DoLogin();
                base.Repaint();
            }
            if (this.m_Username == string.Empty)
            {
                EditorGUI.FocusTextInControl("username");
            }
        }
All Usage Examples Of UnityEditor.EditorGUILayout::PasswordField