Skip to main content

VirtualInputFieldBase

An abstract class in Root.Township, the global namespace.

Base for in-world text fields typed into with the virtual keyboard. Shows placeholder text when empty and can mask secret input.

Constructors​

MemberWhat it is
protected VirtualInputFieldBase()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected string inputBacking field for Input.
7 private and internal fields
MemberWhat it is
private string defaultValuePlaceholder text shown while the input is empty.
private Color inputColorText colour for typed input.
private TextRenderer inputRendererThe TextRenderer that shows the input or the placeholder.
private bool isSecretWhen true, typed text is shown masked with secretKey.
private Color placeHolderColorPlaceholder colour when the field isn't focused.
private Color placeHolderSelectedColorPlaceholder colour while the field is focused.
private string secretKeyString shown once per character when masking secret input (default *).

Properties​

MemberWhat it is
string Input { get; }The text typed so far.
protected string DefaultValue { get; }The placeholder text shown when empty.
protected TextRenderer InputRenderer { get; }The text renderer that shows the field.
protected bool IsSecret { get; }Whether the input is shown as mask characters, like a password.

Methods​

MemberWhat it is
void Clear()Empties the input and shows the placeholder again.
virtual void GetFocus()Changes the placeholder colour to the selected colour while empty.
virtual void LostFocus()Changes the placeholder colour back while empty.
protected virtual void Awake()Shows the placeholder text.
protected virtual void DisplaySecret(bool isShowingSecret)Redraws the text when secret display is toggled.
protected virtual void UpdateInputWithSecret()Redraws the field: masked or plain input, or the placeholder when empty.
protected void UpdateInputWithSecret(bool isSecret)Redraws the field: masked or plain input, or the placeholder when empty.