Text#

class Text#

A text label. Added to a Canvas or a Panel.

RectTransform RectTransform { get; }#

The rect transform for the UI object.

Game Scenes:

All

LayoutElement LayoutElement { get; }#

How much space the UI object asks a layout for.

Game Scenes:

All

Note

Only has an effect when the object is in a panel that has a layout. A canvas is not inside a layout and does not have one.

bool Visible { get; set; }#

Whether the UI object is visible.

Game Scenes:

All

Note

This is the object’s own setting, which is what it was last set to. An object is only drawn when everything it is inside is visible as well, so an interface can be built with its parts visible, inside a panel that is not, and shown all at once by making that panel visible.

string Content { get; set; }#

The text string

Game Scenes:

All

bool WordWrap { get; set; }#

Whether the text wraps onto further lines when it is wider than the space it has. Text that does not wrap carries on past the edge, and its preferred size is that of a single line, so a changing value leaves a layout in place.

Game Scenes:

All

string Font { get; set; }#

Name of the font

Game Scenes:

All

Note

Empty if the game provided no font to draw the text with, in which case it is not drawn. See Text.AvailableFonts for the names that can be set.

IList<string> AvailableFonts { get; }#

A list of all available fonts.

Game Scenes:

All

int Size { get; set; }#

Font size.

Game Scenes:

All

FontStyle Style { get; set; }#

Font style.

Game Scenes:

All

StdLib.ColorRGBA Color { get; set; }#

The color the text is drawn in.

Game Scenes:

All

TextAnchor Alignment { get; set; }#

Alignment.

Game Scenes:

All

float LineSpacing { get; set; }#

Line spacing.

Game Scenes:

All

void Remove ()#

Remove the UI object.

Game Scenes:

All

enum FontStyle#

Font style.

Normal#

Normal.

Bold#

Bold.

Italic#

Italic.

BoldAndItalic#

Bold and italic.

enum TextAlignment#

Text alignment.

Left#

Left aligned.

Right#

Right aligned.

Center#

Center aligned.

enum TextAnchor#

Text alignment.

LowerCenter#

Lower center.

LowerLeft#

Lower left.

LowerRight#

Lower right.

MiddleCenter#

Middle center.

MiddleLeft#

Middle left.

MiddleRight#

Middle right.

UpperCenter#

Upper center.

UpperLeft#

Upper left.

UpperRight#

Upper right.