Game Development Reference
In-Depth Information
GUI.SetNextControlName("UsernameField");
username = GUI.TextField(new Rect(10, 40, 130, 20), username);
GUI.SetNextControlName("PasswordField");
password = GUI.PasswordField(new Rect(10, 70, 130, 20),
password,'*');
if (passwordInError)
{
GUI.Label (new Rect (10, 100, 200, 20),
passwordErrorMessage);
}
if (Event.current.isKey &&
Event.current.keyCode == KeyCode.Return &&
GUI.GetNameOfFocusedControl() == "PasswordField")
{
CheckUserPasswordAndRegister();
}
if (GUI.Button(new Rect(80, 130, 65, 20), "Register"))
{
CheckUserPasswordAndRegister();
}
GUI.EndGroup();
}
Note that the Event keyword here relates to the legacy GUI event
system for handling user input. See the Event section later in this
chapter for more information.
This is NOT to be confused with the UnityEvent system introduced
with the new UI system.
These results are shown in the following GUI screen:
 
Search WWH ::




Custom Search