Text#

Text

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

A Text object is passed and returned as its identifier, a number. A path that acts on an object takes it as (id).

GET /ui/text/(id)/rect-transform#

The rect transform for the UI object.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (UI.RectTransform)

GET /ui/text/(id)/layout-element#

How much space the UI object asks a layout for.

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.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (UI.LayoutElement)

GET /ui/text/(id)/visible#

Whether the UI object is visible.

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.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (bool)

PUT /ui/text/(id)/visible#

Whether the UI object is visible.

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.

Parameters:
  • id – The identifier of the Text object.

Request JSON Object:
  • value (bool) – The new value.

GET /ui/text/(id)/content#

The text string

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (string)

PUT /ui/text/(id)/content#

The text string

Parameters:
  • id – The identifier of the Text object.

Request JSON Object:
  • value (string) – The new value.

GET /ui/text/(id)/word-wrap#

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.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (bool)

PUT /ui/text/(id)/word-wrap#

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.

Parameters:
  • id – The identifier of the Text object.

Request JSON Object:
  • value (bool) – The new value.

GET /ui/text/(id)/font#

Name of the font

Note

Empty if the game provided no font to draw the text with, in which case it is not drawn. See GET /ui/text/(id)/available-fonts for the names that can be set.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (string)

PUT /ui/text/(id)/font#

Name of the font

Note

Empty if the game provided no font to draw the text with, in which case it is not drawn. See GET /ui/text/(id)/available-fonts for the names that can be set.

Parameters:
  • id – The identifier of the Text object.

Request JSON Object:
  • value (string) – The new value.

GET /ui/text/(id)/available-fonts#

A list of all available fonts.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (list<string>)

GET /ui/text/(id)/size#

Font size.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (int32)

PUT /ui/text/(id)/size#

Font size.

Parameters:
  • id – The identifier of the Text object.

Request JSON Object:
  • value (int32) – The new value.

GET /ui/text/(id)/style#

Font style.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (UI.FontStyle)

PUT /ui/text/(id)/style#

Font style.

Parameters:
  • id – The identifier of the Text object.

Request JSON Object:
  • value (UI.FontStyle) – The new value.

GET /ui/text/(id)/color#

The color the text is drawn in.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (StdLib.ColorRGBA)

PUT /ui/text/(id)/color#

The color the text is drawn in.

Parameters:
  • id – The identifier of the Text object.

Request JSON Object:
  • value (StdLib.ColorRGBA) – The new value.

GET /ui/text/(id)/alignment#

Alignment.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (UI.TextAnchor)

PUT /ui/text/(id)/alignment#

Alignment.

Parameters:
  • id – The identifier of the Text object.

Request JSON Object:
  • value (UI.TextAnchor) – The new value.

GET /ui/text/(id)/line-spacing#

Line spacing.

Parameters:
  • id – The identifier of the Text object.

Response JSON Object:
  • value (float)

PUT /ui/text/(id)/line-spacing#

Line spacing.

Parameters:
  • id – The identifier of the Text object.

Request JSON Object:
  • value (float) – The new value.

POST /ui/text/(id)/remove#

Remove the UI object.

Parameters:
  • id – The identifier of the Text object.

FontStyle

Font style.

Passed and returned as the name of one of its values:

"normal"

Normal.

"bold"

Bold.

"italic"

Italic.

"bold_and_italic"

Bold and italic.

TextAlignment

Text alignment.

Passed and returned as the name of one of its values:

"left"

Left aligned.

"right"

Right aligned.

"center"

Center aligned.

TextAnchor

Text alignment.

Passed and returned as the name of one of its values:

"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.