Editor.Components.Text
ClassRenders and manages text in the scene with customizable font, size, layout, and visual effects.
Index
Properties
- advancedLayout
- backgroundSettings
- capitalizationOverride
- customMaterial
- debugRenderLayoutRect
- depthTest
- dropshadowSettings
- editable
- enabled
- enableRichText
- font
- fontSource
- hasPrefabChanges
- horizontalAlignment
- horizontalOverflow
- id
- isPrefabInstanceRoot
- italic?
- layoutRect
- letterSpacing
- lineSpacing
- meshShadowMode
- meta
- name
- outlineSettings
- preferredStyle
- renderOrder
- sceneObject
- shadowColor
- shadowDensity
- showEditingPreview
- size
- sizeToFit
- stretchMode
- text
- textFill
- touchHandler
- twoSided
- type
- verticalAlignment
- verticalOverflow
- weight?
Methods
Example
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const scene = model.project.scene;
const obj = scene.createSceneObject('TextObj');
const text = obj.addComponent('Text') as Editor.Components.Text;
text.text = 'Hello World';
text.size = 48;
text.italic = false;
text.depthTest = false;
text.letterSpacing = 0.0;
Extends
Properties
advancedLayout
advancedLayout:
TextAdvancedLayout
Advanced layout configuration for text rendering.
backgroundSettings
backgroundSettings:
BackgroundSettings
Background appearance settings for the text.
capitalizationOverride
capitalizationOverride:
CapitalizationOverride
Override text capitalization style.
customMaterial
customMaterial:
Material
A custom Material to render this Text with, authored from a Mesh3d shader graph that uses the Text Data node. The material must have a single Pass; if it is invalid (unsupported shader or more than one Pass) or null (the default), Text renders with the built-in text shader.
debugRenderLayoutRect
debugRenderLayoutRect:
boolean
If enabled, draws the Text.layoutRect bounds as a wireframe for debugging text layout. Has no effect when a Editor.Components.ScreenTransform is attached to the same SceneObject, since the ScreenTransform supersedes the layoutRect.
depthTest
depthTest:
boolean
Enable or disable depth testing for text rendering.
dropshadowSettings
dropshadowSettings:
DropshadowSettings
Drop shadow effect settings for the text.
editable
editable:
boolean
Enable or disable text editing in preview mode.
enabled
enabled:
boolean
Whether the component is active.
Inherited from
enableRichText
enableRichText:
boolean
If enabled, inputted text will be interpreted as rich text.
font
font:
Font
Font asset used for rendering text.
fontSource
fontSource:
Font|FontCollection|FontFamily
The font source for this text component. Can be a Font, FontFamily, or FontCollection asset.
hasPrefabChanges
readonlyhasPrefabChanges:boolean
Whether this entity differs from its counterpart in the prefab or was added to the prefab instance. Always false outside prefab instances.
Inherited from
BaseMeshVisual.hasPrefabChanges
horizontalAlignment
horizontalAlignment:
Horizontal
Horizontal alignment of the mesh visual.
Inherited from
BaseMeshVisual.horizontalAlignment
horizontalOverflow
horizontalOverflow:
HorizontalOverflow
Behavior when text exceeds horizontal bounds.
id
readonlyid:Uuid
The unique id of the entity.
Inherited from
isPrefabInstanceRoot
readonlyisPrefabInstanceRoot:boolean
Whether this entity is the root of a prefab instance.
Inherited from
BaseMeshVisual.isPrefabInstanceRoot
italic?
optionalitalic?:boolean
Enable or disable italic text styling.
layoutRect
layoutRect:
Rect
The rectangular bounds the text is laid out within. Controls text wrapping and alignment, and defines the area Text.horizontalOverflow, Text.verticalOverflow, and Text.sizeToFit are evaluated against. Each bound is defined as an offset in world units from the SceneObject's position. If a Editor.Components.ScreenTransform is attached to the same SceneObject, it always supersedes this property text is laid out within the ScreenTransform's rect instead, and changes to layoutRect have no effect.
letterSpacing
letterSpacing:
number
Spacing between individual characters.
lineSpacing
lineSpacing:
number
Spacing between text lines.
meshShadowMode
meshShadowMode:
MeshShadowMode
Shadow rendering mode for the mesh.
Inherited from
meta
readonlymeta:Meta
Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.
Inherited from
name
name:
string
Name of the component.
Inherited from
outlineSettings
outlineSettings:
OutlineSettings
Text outline effect settings.
preferredStyle
preferredStyle:
string
Controls style applied to the text. Accepts a Editor.Components.FontStyles constant (e.g. FontStyles.Bold). If Text.fontSource is assigned to a variable font or a font collection with variable fonts, this also accepts a named instance name or custom variation style name that belongs to the variable font. Matching is case-insensitive and ignores whitespace and hyphens, so "Bold Italic", "bolditalic", and "bold-italic" all resolve to the same style. If Text.weight or Text.italic are explicitly assigned, they will override any weight or italic axis value in preferredStyle.
renderOrder
renderOrder:
number
Determines the order in which this visual component is rendered relative to others.
Inherited from
sceneObject
readonlysceneObject:SceneObject
Scene object this component is attached to.
Inherited from
shadowColor
shadowColor:
vec4
Color of the mesh shadow.
Inherited from
shadowDensity
shadowDensity:
number
Opacity of the mesh shadow.
Inherited from
showEditingPreview
showEditingPreview:
boolean
Show the text editing preview in the editor.
size
size:
number
Font size in units.
sizeToFit
sizeToFit:
boolean
Automatically scale text to fit bounds.
stretchMode
stretchMode:
StretchMode
How the mesh stretches to fit its container.
Inherited from
text
text:
string
The text string to render.
textFill
textFill:
TextFill
Text color and fill settings.
touchHandler
touchHandler:
InteractionComponent
Enable or disable touch interaction for text.
twoSided
twoSided:
boolean
Render text on both sides of the plane.
type
readonlytype:string
The entity's type.
Inherited from
verticalAlignment
verticalAlignment:
Vertical
Vertical alignment of the mesh visual.
Inherited from
BaseMeshVisual.verticalAlignment
verticalOverflow
verticalOverflow:
VerticalOverflow
Behavior when text exceeds vertical bounds.
weight?
optionalweight?:number
Font weight value.
Methods
getDirectlyReferencedEntities()
getDirectlyReferencedEntities():
Entity[]
A list of entities which this entity has a reference to.
Returns
Entity[]
Inherited from
BaseMeshVisual.getDirectlyReferencedEntities
getMeta()
staticgetMeta():Meta
Returns metadata about this type.
Returns
Overrides
getOwnedEntities()
getOwnedEntities():
Entity[]
A list of entities which has a reference to this entity.
Returns
Entity[]
Inherited from
BaseMeshVisual.getOwnedEntities
getPrefabInstanceRoot()
getPrefabInstanceRoot():
Prefabable
Returns the nearest prefab instance root that contains this entity, starting with the entity itself, or null if it is not part of a prefab instance.
Returns
Inherited from
BaseMeshVisual.getPrefabInstanceRoot
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean