Text#

class UI.Text#

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

rect_transform: UI.RectTransform#

The rect transform for the UI object.

Attribute:

Read-only, cannot be set

Return type:

UI.RectTransform

layout_element: UI.LayoutElement#

How much space the UI object asks a layout for.

Attribute:

Read-only, cannot be set

Return type:

UI.LayoutElement

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.

visible: boolean#

Whether the UI object is visible.

Attribute:

Can be read or written

Return type:

boolean

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.

content: string#

The text string

Attribute:

Can be read or written

Return type:

string

word_wrap: boolean#

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.

Attribute:

Can be read or written

Return type:

boolean

font: string#

Name of the font

Attribute:

Can be read or written

Return type:

string

Note

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

available_fonts: List#

A list of all available fonts.

Attribute:

Read-only, cannot be set

Return type:

List

size: number#

Font size.

Attribute:

Can be read or written

Return type:

number

style: UI.FontStyle#

Font style.

Attribute:

Can be read or written

Return type:

UI.FontStyle

color: StdLib.ColorRGBA#

The color the text is drawn in.

Attribute:

Can be read or written

Return type:

StdLib.ColorRGBA

alignment: UI.TextAnchor#

Alignment.

Attribute:

Can be read or written

Return type:

UI.TextAnchor

line_spacing: number#

Line spacing.

Attribute:

Can be read or written

Return type:

number

remove()#

Remove the UI object.

class UI.FontStyle#

Font style.

normal#

Normal.

bold#

Bold.

italic#

Italic.

bold_and_italic#

Bold and italic.

class UI.TextAlignment#

Text alignment.

left#

Left aligned.

right#

Right aligned.

center#

Center aligned.

class UI.TextAnchor#

Text alignment.

lower_center#

Lower center.

lower_left#

Lower left.

lower_right#

Lower right.

middle_center#

Middle center.

middle_left#

Middle left.

middle_right#

Middle right.

upper_center#

Upper center.

upper_left#

Upper left.

upper_right#

Upper right.