Text
Updated
Crisp, cheap flat text label in the world.
- Type
comp-text- Script class
TextComponent- Per entity
- One
- Version
- 1.1.0
Read about it in Text: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
fontSize |
0. |
|
letterSpacing |
-10 ≤ x ≤ 10 |
|
lineHeight |
-10 ≤ x ≤ 10 |
|
maxWidth |
0 ≤ x ≤ 10000 |
|
outlineWidth |
0 ≤ x ≤ 100 |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A name tag that faces the playerA name tag over a character waits for its text layout, measures it to fit a dark backing plate, and turns to the camera every frame.
Drag to orbit the camera: the name tag keeps facing you. Scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(TextComponent); if (component) log(component.props);}