Text
From a script
ts
import { TextComponent } from "mmpx";
const text = this.entity.TryGetComponent(TextComponent);Full API: TextComponent.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
Texttext | string | — | |
Materialmaterial | material asset | — | A sprite-domain material — a shader drawing this component |
Font
| Field | Type | Default | Description |
|---|---|---|---|
FontfontAssetId | font asset | — | |
Font FamilyfontFamily | string | "sans-serif" | |
SizefontSize | number (1 … ∞) (px) | 24 | |
Line HeightlineHeight | number (1 … ∞) (px) | 40 | |
Colorcolor | colour | #FFFFFF | |
Alignalign | "left" | "center" | "right" | "left" |
Layout
| Field | Type | Default | Description |
|---|---|---|---|
WrapwrapEnabled | boolean | false | |
Shrink To FitshrinkToFit | boolean | false | |
Crisp TextcrispText | boolean | false | Renders at device resolution — sharper, costs more texture memory |
Stroke
| Field | Type | Default | Description |
|---|---|---|---|
ColorstrokeColor | colour | #000000 | |
WidthstrokeWidth | number (px) | 2 |
Shadow
| Field | Type | Default | Description |
|---|---|---|---|
ColordropShadowColor | colour | #000000 | |
BlurdropShadowBlur | number (0 … ∞) | 2 | |
DistancedropShadowDistance | number (px) | 6 |