Table of Contents

Class TextInput

Namespace
MagicUI.Elements
Assembly
MagicUI.dll

A text input element

public sealed class TextInput : ArrangableElement, IGameObjectWrapper, IControllerInteractable
Inheritance
TextInput
Implements
Inherited Members
Extension Methods

Constructors

TextInput(LayoutRoot, string)

Creates a text input

public TextInput(LayoutRoot onLayout, string name = "New TextInput")

Parameters

onLayout LayoutRoot

The layout to draw the input on

name string

The name of the input

Properties

Borderless

Whether the text input should be displayed in a borderless style.

public bool Borderless { get; set; }

Property Value

bool

ContentColor

The color of the text

public Color ContentColor { get; set; }

Property Value

Color

ContentType

The content type of the input. MagicUI does not provide API support for UnityEngine.UI.InputField.ContentType.Custom at this time.

public InputField.ContentType ContentType { get; set; }

Property Value

InputField.ContentType

Enabled

Whether the input is enabled

public bool Enabled { get; set; }

Property Value

bool

Font

The font to use to draw text

public Font Font { get; set; }

Property Value

Font

FontSize

The font size for the text

public int FontSize { get; set; }

Property Value

int

GameObject

The UnityEngine.GameObject underlying this UI element

public GameObject GameObject { get; }

Property Value

GameObject

IconColor

The color of the quill icon

public Color IconColor { get; set; }

Property Value

Color

IconSpacing

The spacing between the quill icon

public float IconSpacing { get; set; }

Property Value

float

MinWidth

The minimum width of the text input

public float MinWidth { get; set; }

Property Value

float

Placeholder

The placeholder text shown when the input is empty

public string Placeholder { get; set; }

Property Value

string

PlaceholderColor

The color of the placeholder

public Color PlaceholderColor { get; set; }

Property Value

Color

Text

The content of the text input

public string Text { get; set; }

Property Value

string

TextAlignment

The alignment of the text within this element

public HorizontalAlignment TextAlignment { get; set; }

Property Value

HorizontalAlignment

UnderlineColor

The color of the underline

public Color UnderlineColor { get; set; }

Property Value

Color

Methods

ArrangeOverride(Vector2)

Internal implementation to position the object within the allocated space.

protected override void ArrangeOverride(Vector2 alignedTopLeftCorner)

Parameters

alignedTopLeftCorner Vector2

The space available for the element.

Deactivate()

Deactivates the text input.

public void Deactivate()

DestroyOverride()

Internal implementation to perform any additional cleanup when the element is destroyed

protected override void DestroyOverride()

GetSelectable()

Gets the Unity UnityEngine.UI.Selectable underlying the element

public Selectable GetSelectable()

Returns

Selectable

MeasureOverride()

Internal implementation to calculate desired size.

protected override Vector2 MeasureOverride()

Returns

Vector2

SelectAndActivate()

Selects and activates the text input.

public void SelectAndActivate()

Events

OnHover

Event that fires when the text input is hovered over, either by mouse or controller inputs.

public event Action<TextInput>? OnHover

Event Type

Action<TextInput>

OnUnhover

Event that fires when the text input stops being hovered over, either by mouse or controller inputs.

public event Action<TextInput>? OnUnhover

Event Type

Action<TextInput>

TextChanged

Event that fires when the text changes, e.g. when a key is entered. Sends this input and its current text.

public event Action<TextInput, string>? TextChanged

Event Type

Action<TextInput, string>

TextEditFinished

Event that fires when the edit is completed, e.g. by clicking off the element. Sends this input and its current text.

public event Action<TextInput, string>? TextEditFinished

Event Type

Action<TextInput, string>