Scripting API

InputField

class in UnityEngine.UI · UnityEngine.UI · inherits from Selectable

76 of 89 of Unity's members
In Tassix

A text box. Selected (clicked, or activated), it takes the keyboard's text and editing keys each frame; Return submits a single-line field and Escape cancels, restoring the text from before. The label shows the text (asterisks for passwords), scrolled to keep the caret in view.

Properties 37

char asteriskChar { get; set; }
float caretBlinkRate { get; set; }
Color caretColor { get; set; }
int caretPosition { get; set; }

The caret: the selection's focus end.

int caretWidth { get; set; }
int characterLimit { get; set; }
CharacterValidation characterValidation { get; set; }
ContentType contentType { get; set; }
bool customCaretColor { get; set; }
virtual float flexibleHeight { get; }
virtual float flexibleWidth { get; }
InputType inputType { get; set; }
bool isFocused { get; }
TouchScreenKeyboardType keyboardType { get; set; }
virtual int layoutPriority { get; }
LineType lineType { get; set; }
virtual float minHeight { get; }
virtual float minWidth { get; }
bool multiLine { get; }
EndEditEvent onEndEdit { get; set; }
SubmitEvent onSubmit { get; set; }
OnValidateInput? onValidateInput { get; set; }
OnChangeEvent onValueChange { get; set; }
OnChangeEvent onValueChanged { get; set; }
Graphic? placeholder { get; set; }
virtual float preferredHeight { get; }
virtual float preferredWidth { get; }
bool readOnly { get; set; }
int selectionAnchorPosition { get; set; }
Color selectionColor { get; set; }
int selectionFocusPosition { get; set; }
virtual bool shouldActivateOnSelect { get; set; }
bool shouldHideMobileInput { get; set; }
string text { get; set; }
Text? textComponent { get; set; }
TouchScreenKeyboard? touchScreenKeyboard { get; }
bool wasCanceled { get; }

Methods 22

void ActivateInputField()

Focuses the field at the end of the frame (selecting all of it).

virtual void CalculateLayoutInputHorizontal()
virtual void CalculateLayoutInputVertical()
void DeactivateInputField()

Ends editing: restores the text when canceled, sends onEndEdit.

void ForceLabelUpdate()
virtual void GraphicUpdateComplete()
virtual void LayoutComplete()
void MoveTextEnd(bool shift)
void MoveTextStart(bool shift)
virtual void OnBeginDrag(PointerEventData eventData)
void OnDeselect(BaseEventData eventData)
virtual void OnDrag(PointerEventData eventData)

Dragging selects from the anchor to the character under the pointer.

virtual void OnEndDrag(PointerEventData eventData)
virtual void OnPointerClick(PointerEventData eventData)
void OnPointerDown(PointerEventData eventData)

The first press selects the field; once it's focused, presses place the caret.

void OnSelect(BaseEventData eventData)
virtual void OnSubmit(BaseEventData eventData)
virtual void OnUpdateSelected(BaseEventData eventData)

The frame's keyboard events, while focused: editing, then submit or cancel.

void ProcessEvent(Event e)

A key press, as typing would deliver it (used by editors and tests to drive the field).

virtual void Rebuild(CanvasUpdate update)
Vector2 ScreenToLocal(Vector2 screen)
void SetTextWithoutNotify(string input)

Not in Tassix yet 13

Append ClampPos OnFocus OnValidate caretPositionInternal caretSelectPositionInternal m_CaretPosition m_CaretSelectPosition m_CaretVisible m_CursorVerts m_Keyboard m_Mesh mesh