share
- Last UpdatedFeb 19, 2025
- 3 minute read
The share element is a script command. It cannot be referenced by other nodes.
-
It provides a method for information sharing among the nodes of an application.
-
The IO variables have been removed as the tags (linkin, linkout, linkinout) used to handle their connection to the fields. With the new approach the node fields themselves are directly shared with the share tag.
Platform support
This element is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, and XR-Portable Androi. It is not supported on XR-Portable WASM platform.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
No support |
|
|
|
|
|
|
Code example
This is a code example for the share element.
<share field="V529023.value"/>
Fields
These are the fields for share command.
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
direction |
senum |
Optional |
inout |
Specifies the share direction: in, out, or inout. |
|
field |
sstring |
Mandatory |
Not set |
The unique name of the field to be shared. |
|
refreshTime |
sfloat |
Optional |
-1 |
If greater than zero, this value will be used as the minimum time elapsed between the sharing of a field value. For example, a field that changes every game frame with a refreshTime of 0.5 seconds will be exchanged only twice every second. Note that refreshTime and tolerance are mutually exclusive. In cases where both are defined, refreshTime will be used and tolerance ignored. |
|
stateZero |
sbool |
Optional |
True |
Set to false to skip zero state coming from the server. |
|
tolerance |
sdouble |
Optional |
-1 |
If greater than zero, this value will be used as the minimum variation for which the shared field is sent to other instances. Only fields of type SINT, SFLOAT, SDOUBLE, SVEC2, SVEC3, SVEC4 and SQUAT can use this field. Note that SVEC2, SVEC3, SVEC4 and SQUAT do a mere comparison of corresponding values, and not a real distance check. For example, on SVEC2 the tolerance check is passed if x or y value are different more than tolerance from the latest sent values: Abs(x -x1) >= tolerance || Abs(y-y1) >= tolerance. Also note that refreshTime and tolerance are mutually exclusive. In cases where both are defined, refreshTime will be used and tolerance ignored. |