Class GhostCustomSerializerExtensions
Extension methods for all unmanaged types implementing the
IGhost
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 |
Int |
snapshot | the snapshot buffer |
Int |
baseline | the baseline to diff against. Can be a zere baseline |
Int |
snapshotDynamicData | the dynamic snapshot data buffer |
Int |
baselineDynamicData | the dynamic snapshot data buffer baseline |
Int |
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 |
Data |
writer | the data writer |
Stream |
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 |
Int |
snapshot | the snapshot buffer |
Int |
baseline | the baseline to diff against. Can be a zere baseline |
Int |
changeMaskData | the change mask bits buffer |
int | startOffset | the bitmask start offset |
int | snapshotOffset | the data start offset |
Data |
writer | the data writer |
Stream |
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 Ghost
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 |
Int |
snapshot | the snapshot buffer |
Int |
baseline0 | the first baseline to diff against. |
Int |
baseline1 | the second baseline to diff against. |
Int |
baseline2 | the third baseline to diff against. |
Int |
changeMaskData | the change mask bits buffer |
int | startOffset | the bitmask start offset |
int | snapshotOffset | the data start offset |
Ghost |
predictor | the delta predictor instance |
Data |
writer | the data writer |
Stream |
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 |