Text
A run of text: a label, a heading, a line of dialogue. Turn on Wrap to break long lines at spaces to fit the box. Turn on Rich to read [b]...[/b] markup, and advance Visible Characters for a typewriter reveal. Goes under a Canvas.
On this page
Add it
+ Add node → Label, Localized Label, Button, Menu Button, Toggle, Dropdown, Virtual Button creates a node with it already on. Already have a node for it? Add component → TextComponent.
From a script
A script on the same node writes these fields by name. TextComponent is the name to pass.
rgs
set_text("TextComponent", "text", "Text");
set_number("TextComponent", "scale", 2.0);
set_colour("TextComponent", "color", vec4(1.0, 1.0, 1.0, 1.0));
set_flag("TextComponent", "wrap", false);
set_flag("TextComponent", "rich", false);
set_colour("TextComponent", "outline", vec4(0.0, 0.0, 0.0, 1.0));
set_number("TextComponent", "outline_width", 0.0);
set_colour("TextComponent", "shadow", vec4(0.0, 0.0, 0.0, 0.0));
set_point("TextComponent", "shadow_offset", vec2(2.0, 2.0));
set_number("TextComponent", "shadow_softness", 1.0); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Text | text | text, several lines | Text | What it says. Press Enter for a new line. |
| Scale | scale | number, 0.1 to 16, step 0.1 | 2 | Scales the size of the text. |
| Color | color | colour | #ffffff | Colour of the text, including how see-through it is. |
| Align | align | one of Left, Center, Right | Left | Where the text sits horizontally inside its box. |
| Wrap | wrap | checkbox | off | Breaks long lines at spaces to fit the box's width, or the Max of a Content Size Fitter that sizes the width to the text. |
| Rich | rich | checkbox | off | Read the text as [b]…[/b] markup. |
| Visible Characters | visible_characters | section | none | How many characters to reveal, like a typewriter. Off shows the whole text. |
| Outline | outline | colour | #000000 | Colour of the outline drawn behind the letters. |
| Outline Width | outline_width | number, 0 to 8, step 0.5 | 0 | How far the outline reaches, in UI units. Zero draws none. |
| Effects | ||||
| Effect Mode | effect_mode | one of Copies, DistanceField | Copies | Which way the outline and shadow are drawn. |
| Shadow | shadow | colour | #000000, 0% opaque | Colour of the drop shadow behind the letters. |
| Shadow Offset | shadow_offset | two numbers (x, y) | (2, 2) | How far the shadow is offset from the letters, in UI units. |
| Shadow Softness | shadow_softness | number, 0 to 16, step 0.5 | 1 | How far the shadow's edge is blurred, in UI units. |