TextRender
/// tip
TextRender is an Actor so it inherits all functions from Actor
///
Constructor
Example
local text = TextRender(
Vector(0, 200, 100),
Rotator(0, 0, 0),
"Hello World",
Vector(2, 2, 1),
Color(255, 255, 255, 255),
FontType.RobotoMono
)
| Name | Type | Default | Description |
|---|---|---|---|
Location | Vector | (0,0,0) | World-space position to place the text |
Rotation | Rotator | (0,0,0) | World-space rotation of the text actor |
Text | string | Required | The text string to display |
Scale | Vector | (1,1,1) | Scale of the text in X and Y directions |
Color | Color | (255,255,255,255) | Text render color (RGB + Alpha) |
FontParam | enum | FontType.Roboto | Engine font enum or asset path to a custom font |
Functions
SetText
Updates the text content
- message:
string
Example
text:SetText("Updated Message")
SetTextRenderColor
Changes the text color
- Color: Color
Example
text:SetTextRenderColor(Color(255, 0, 0, 255)) -- red
SetFont
Changes the font to an engine enum or a loaded asset
- Font: FontType
Example
text:SetFont(FontType.RobotoMono)
SetXScale
Sets horizontal scale (width)
- scale:
number
Example
text:SetXScale(2.0)
SetYScale
Sets vertical scale (depth)
- scale:
number
Example
text:SetYScale(1.0)