patch
- Last UpdatedDec 06, 2023
- 2 minute read
The patch command does not create an object in memory, but can be used to overwrite a value of another node during startup.
-
This command works only at startup.
-
It must always refer to a target node already parsed, so that a node cannot be patched above its definition.
-
If multiple patches are applied to a field node, the value is the last one to be kept.
-
The main use of patch element is inside conditional blocks.
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 the patch element.
<camera name="cam" clone="Camera01" type="avatar" near="0.1" far="1000"/>
<ifdef variable="custom.player" value="viewer">
<patch name="cam" vcr="false" vcrActive="true"/>
</ifdef>
Position
You can place the patch element anywhere, but you must refer to a node that is defined in the script.
Fields
These are the fields for patch command.
|
Fields |
Type |
Use |
Default |
Description |
|---|---|---|---|---|
|
name |
sstring |
Mandatory |
Not set |
The unique name of a node already defined inside the script. |
|
postLink |
sbool |
Optional |
False |
If set to true, the patch is applied after linking the nodes to the data (3D model). This option is necessary to override those fields that are created during linking phase. |
|
xxx |
xxx type |
(1-n) Optional |
Not set |
xxx is a field of the source node that must be patched. Patching a field means overwriting its configuration value. |