VoxelBlockSerializer
Low-level utility to save and load the data within a VoxelBuffer. This can be useful to send data over the network, or to store it in a file.
Low-level utility to save and load the data within a VoxelBuffer. This can be useful to send data over the network, or to store it in a file.
To store into a file allocating a PackedByteArray:
To read it back:
To store into a file by re-using a StreamPeerBuffer:
To read it back:
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VoxelBlockSerializerConstructor
public VoxelBlockSerializer();Methods5
DeserializeFromByteArray2 overloads
public static void DeserializeFromByteArray(byte[] bytes, VoxelBuffer voxelBuffer, bool decompress);Reads the data of a VoxelBuffer from a byte[].
| Name | Type | Default |
|---|---|---|
bytes | byte[] | — |
voxelBuffer | VoxelBuffer | — |
decompress | bool | — |
public static void DeserializeFromByteArray(ReadOnlySpan<byte> bytes, VoxelBuffer voxelBuffer, bool decompress);Reads the data of a VoxelBuffer from a byte[].
| Name | Type | Default |
|---|---|---|
bytes | ReadOnlySpan<byte> | — |
voxelBuffer | VoxelBuffer | — |
decompress | bool | — |
DeserializeFromStreamPeervoid
public static void DeserializeFromStreamPeer(StreamPeer peer, VoxelBuffer voxelBuffer, long size, bool decompress);Reads the data of a VoxelBuffer from a StreamPeer. You must provide the number of bytes to read.
| Name | Type | Default |
|---|---|---|
peer | StreamPeer | — |
voxelBuffer | VoxelBuffer | — |
size | long | — |
decompress | bool | — |
SerializeToByteArraybyte[]
public static byte[] SerializeToByteArray(VoxelBuffer voxelBuffer, VoxelBlockSerializer.Compression compress);Stores the data of a VoxelBuffer into a byte[].
| Name | Type | Default |
|---|---|---|
voxelBuffer | VoxelBuffer | — |
compress | VoxelBlockSerializer.Compression | — |
byte[]SerializeToStreamPeerint
public static int SerializeToStreamPeer(StreamPeer peer, VoxelBuffer voxelBuffer, VoxelBlockSerializer.Compression compress);Stores the data of a VoxelBuffer into a StreamPeer. Returns the number of written bytes.
| Name | Type | Default |
|---|---|---|
peer | StreamPeer | — |
voxelBuffer | VoxelBuffer | — |
compress | VoxelBlockSerializer.Compression | — |
int