Home › Page › UghTextField

UghTextField

UghTextField

Inherits from UghControl.

UghTextField is used to collect text information from the user.  On mobile platforms this class will invoke the native keyboard.  On desktop platforms this class will respond to key inputs.  Text input will only occur when the UghTextField has focus.  Only a single UghTextField may have focus at a time.

Class Variables
name type description
field UghText The UghText field used to display output.
enteredText string The user-entered text.
Class Functions
name type description
OnUghInputUpAsButton void Called by UghInput when this object is clicked on like a button.
UnfocusTextField void Cause this UghTextField to lose focus.

-

Using UghTextField

Place an UghTextField in the scene, make sure to correctly size its Collider, and then assign an UghText to its field variable.  When the user clicks or touches inside of the collider, the text field will gain focus and the user will be able to enter text.  The value of the text field is held in the enteredText variable, and you may check this value at any time.