Ejemplo n.º 1
0
        private void OnGUI()
        {
            // Display the player name field, disabled. So the user must click on the "Change Player Name" button to set it
            GUI.enabled = false;
            EditorGUILayout.TextField("Player Name", m_PlayerName);
            GUI.enabled = true;

            if (GUILayout.Button("Change Player Name", GUILayout.Height(40f)))
            {
                // Display a prompt dialog window that will set the new player name when the user confirms
                Prompt.DisplayPrompt("Change Player Name", "What is the new name of the player?\n\nYou can validate by clicking on the \"Ok\" button, or by pressing the return key.\nYou can cancel by clicking on the \"Cancel\" button, or by pressing the escape key.", this, (answer) =>
                {
                    m_PlayerName = answer;
                    Repaint();
                });
            }
        }