Class GhostCustomSerializerExtensions
Extension methods for all unmanaged types implementing the IGhostSerializer interface.
Inherited Members
Namespace: Unity.NetCode.LowLevel.Unsafe
Assembly: Unity.NetCode.dll
Syntax
public static class GhostCustomSerializerExtensions
Methods
SerializeBuffer<TSerializer>(TSerializer, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, ref int, ref int, ref int, ref DataStreamWriter, in StreamCompressionModel, int)
Serialize a single buffer to the datastream using the default buffer serialisation strategy.
Declaration
public static int SerializeBuffer<TSerializer>(this TSerializer serializer, IntPtr snapshot, IntPtr baseline, IntPtr snapshotDynamicData, IntPtr baselineDynamicData, IntPtr changeMaskData, ref int startOffset, ref int snapshotOffset, ref int dynamicSize, ref DataStreamWriter writer, in StreamCompressionModel compressionModel, int sendBuffer = 1) where TSerializer : unmanaged, IGhostSerializer
Parameters
Type | Name | Description |
---|---|---|
TSerializer | serializer | the serializer instance |
IntPtr | snapshot | the snapshot buffer |
IntPtr | baseline | the baseline to diff against. Can be a zere baseline |
IntPtr | snapshotDynamicData | the dynamic snapshot data buffer |
IntPtr | baselineDynamicData | the dynamic snapshot data buffer baseline |
IntPtr | changeMaskData | the change mask bits buffer |
int | startOffset | the bitmask start offset |
int | snapshotOffset | the data start offset |
int | dynamicSize | the writtern data size in bytes in the dynamic snapshot buffer |
DataStreamWriter | writer | the data writer |
StreamCompressionModel | compressionModel | the compression model |
int | sendBuffer | denote if the buffer should be sent or not |
Returns
Type | Description |
---|---|
int | the number of bits written in the stream |
Type Parameters
Name | Description |
---|---|
TSerializer | the seralizer type |
SerializeComponentSingleBaseline<TSerializer>(TSerializer, IntPtr, in IntPtr, IntPtr, ref int, ref int, ref DataStreamWriter, in StreamCompressionModel, int)
Serialize the given component into the data stream by using a single baseline.
Declaration
public static int SerializeComponentSingleBaseline<TSerializer>(this TSerializer serializer, IntPtr snapshot, in IntPtr baseline, IntPtr changeMaskData, ref int startOffset, ref int snapshotOffset, ref DataStreamWriter writer, in StreamCompressionModel compressionModel, int sendComponent = 1) where TSerializer : unmanaged, IGhostSerializer
Parameters
Type | Name | Description |
---|---|---|
TSerializer | serializer | the serializer instance |
IntPtr | snapshot | the snapshot buffer |
IntPtr | baseline | the baseline to diff against. Can be a zere baseline |
IntPtr | changeMaskData | the change mask bits buffer |
int | startOffset | the bitmask start offset |
int | snapshotOffset | the data start offset |
DataStreamWriter | writer | the data writer |
StreamCompressionModel | compressionModel | the compression model |
int | sendComponent | instruct if the component should be sent or not |
Returns
Type | Description |
---|---|
int | the number of bits written in the stream |
Type Parameters
Name | Description |
---|---|
TSerializer | the seralizer type |
SerializeComponentThreeBaseline<TSerializer>(TSerializer, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, ref int, ref int, ref GhostDeltaPredictor, ref DataStreamWriter, in StreamCompressionModel, int)
Serialize the given component into the data stream by using three baselines. The GhostDeltaPredictor will calculate new predicted baseline that will be used for delta compression.
Declaration
public static int SerializeComponentThreeBaseline<TSerializer>(this TSerializer serializer, IntPtr snapshot, IntPtr baseline0, IntPtr baseline1, IntPtr baseline2, IntPtr changeMaskData, ref int startOffset, ref int snapshotOffset, ref GhostDeltaPredictor predictor, ref DataStreamWriter writer, in StreamCompressionModel compressionModel, int sendComponent = 1) where TSerializer : unmanaged, IGhostSerializer
Parameters
Type | Name | Description |
---|---|---|
TSerializer | serializer | the serializer instance |
IntPtr | snapshot | the snapshot buffer |
IntPtr | baseline0 | the first baseline to diff against. |
IntPtr | baseline1 | the second baseline to diff against. |
IntPtr | baseline2 | the third baseline to diff against. |
IntPtr | changeMaskData | the change mask bits buffer |
int | startOffset | the bitmask start offset |
int | snapshotOffset | the data start offset |
GhostDeltaPredictor | predictor | the delta predictor instance |
DataStreamWriter | writer | the data writer |
StreamCompressionModel | compressionModel | the compression model |
int | sendComponent | denote if the component should be replicated or not. |
Returns
Type | Description |
---|---|
int | the number of bits written in the stream |
Type Parameters
Name | Description |
---|---|
TSerializer | the seralizer type |