Class TextInput
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
LayoutRootThe layout to draw the input on
name
stringThe name of the input
Properties
Borderless
Whether the text input should be displayed in a borderless style.
public bool Borderless { get; set; }
Property Value
ContentColor
The color of the text
public Color ContentColor { get; set; }
Property Value
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
Font
The font to use to draw text
public Font Font { get; set; }
Property Value
FontSize
The font size for the text
public int FontSize { get; set; }
Property Value
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
IconSpacing
The spacing between the quill icon
public float IconSpacing { get; set; }
Property Value
MinWidth
The minimum width of the text input
public float MinWidth { get; set; }
Property Value
Placeholder
The placeholder text shown when the input is empty
public string Placeholder { get; set; }
Property Value
PlaceholderColor
The color of the placeholder
public Color PlaceholderColor { get; set; }
Property Value
Text
The content of the text input
public string Text { get; set; }
Property Value
TextAlignment
The alignment of the text within this element
public HorizontalAlignment TextAlignment { get; set; }
Property Value
UnderlineColor
The color of the underline
public Color UnderlineColor { get; set; }
Property Value
Methods
ArrangeOverride(Vector2)
Internal implementation to position the object within the allocated space.
protected override void ArrangeOverride(Vector2 alignedTopLeftCorner)
Parameters
alignedTopLeftCorner
Vector2The 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
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
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
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
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