InputText2D
- Last UpdatedFeb 19, 2025
- 2 minute read
The InputText2D node is a specialized version of Text2D that supports keyboard text input.
InputText2D works differently to Text2D because pressing Enter does not produce a new line, but causes a returnPressed event.
Note: You should manage Activation carefully, especially when there are multiple InputText2D displays together.

Platform support
This element is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Code example
This is a code example for InputText2D.
<InputText2D name="input" templateInfo="InputText2D|input" position="114.0777 435.2265" size="250 50" visible="true" text=" my name is" font="Arial,antialias,20" active="true"/>
InputText2D fields
These are the parameters for the InputText2D node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > RectBase2D > Text2D > InputText2D
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
false |
Activates the keyboard input text display. A blinking caret appears when the InputText2D is active. |
|
caretChar |
sstring |
Optional |
_ |
Allows you to change the symbol used as caret representation. If the string is empty, it falls back to default underscore character( _). If the string is longer than a single character, it takes the first character. |
|
dynamicFontScaling |
sbool |
Optional |
true |
Improves the quality of text by applying Dynamic Font Scaling rendering. |
|
maxCharacters |
sint |
Optional |
0 |
Maximum number of characters that can be set. (-1 unlimited, 0 till complete size filling). |
|
returnPressed |
sevent |
Optional |
Triggered when pressing Return or Enter on the keyboard. |