sbinary
- Last UpdatedSep 05, 2024
- 1 minute read
This topic is about the SBINARY data type.
Value syntax
N/A (byte[])
Description
Used for storing raw binary data (such as an image or the content of a Texture2D) in the form of a byte array.
Attributes
These are the attributes for SBINARY.
|
Attribute |
Type |
Description |
|---|---|---|
|
length |
int |
Returns the length of byte array containing the data. |
Use case
The typical use case for SBinary is to be used along with shares to share arbitrary binary data, such as the content of a Texture2D.
The following example shows how to configure a share for an SBinary variable.
<Var type="sbinary" name="mySharedSBinary" />
<if condition="[@def:Message.type]==server">
<share field="mySharedSBinary.value" direction="out" statezero="false" />
</if>
<if condition="[@def:Message.type]==client">
<share field="mySharedSBinary.value" direction="in" statezero="false" />
</if>
Note: We advise keeping the statezero set to false, if possible, when sharing SBinary types. This is due to architectural constraints on the statezero packet, which is always sent and received as a string instead of a binary.