Struct
- Last UpdatedDec 07, 2023
- 2 minute read
A Struct node creates an instance of a structure with a set of populated fields. An instantiated structure can be used as a usual node instance, so that it can route in and out its values.
For example, <route from="timeStruct.start" to="aTimer.start"/>.
The Struct is usually used to group a set of data that belongs to the same scope. This approach is better than having a set of ungrouped variables.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable 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 Struct node.
<Struct name="timeStruct">
<field type="sevent" name="start"/>
<field type="sfloat" name="duration"/>
<field type="sint" name="duration2" value="0"/>
<field type="sstring" name="stringa" value="pipponio"/>
</Struct>
Struct fields
There are no unique fields for Struct node. All fields are inherited from NodeBase.
Field inheritance: NodeBase > Struct
Attributes
These attributes can be used only inside a Struct node. Represents a single attribute of the Struct. Its name must be unique inside the Struct.
|
Attribute |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
name |
sstring |
Mandatory |
Not set |
Name of the attribute. |
|
type |
sstring |
Mandatory |
Not set |
Can be used to trigger storyboard start. |
|
value |
sstring |
Optional |
Not set |
Can be used to assign an initial value to the internal variable. To assign a value at runtime is needed to use commands, such as setVariable. |