docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class BufferSerializationHelper<TComponentType, TSnapshot, TSerializer>

    Helper class used by code-gen to setup the serialisation function pointers.

    Inheritance
    object
    BufferSerializationHelper<TComponentType, TSnapshot, TSerializer>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    public static class BufferSerializationHelper<TComponentType, TSnapshot, TSerializer> where TComponentType : unmanaged where TSnapshot : unmanaged where TSerializer : unmanaged, IGhostSerializer
    Type Parameters
    Name Description
    TComponentType

    The unmanaged buffer the helper serialise

    TSnapshot

    The snaphost data struct that contains the Unity.Entities.IBufferElementData data.

    TSerializer

    A concrete type that implement the IGhostSerializer interface.

    Methods

    CopyBuffersFromSnapshot(IntPtr, IntPtr, int, int, IntPtr, int, int, TSerializer)

    Copy the dynamic buffers content from the snapshot, using the serializer strategy.

    Declaration
    public static void CopyBuffersFromSnapshot(IntPtr stateData, IntPtr snapshotData, int snapshotOffset, int snapshotStride, IntPtr componentData, int componentStride, int count, TSerializer serializer)
    Parameters
    Type Name Description
    IntPtr stateData

    a pointer to the GhostSerializerState struct

    IntPtr snapshotData

    the snapshot buffer

    int snapshotOffset

    the current offset in the snapshot buffer

    int snapshotStride

    the stride to apply to snapshot pointer for each individual entity

    IntPtr componentData

    a pointer to the chunk component data

    int componentStride

    the stride to apply to component pointer for each individual entity

    int count

    the number of entities

    TSerializer serializer

    the IGhostSerialized instance used to serialize the buffer content

    CopyBuffersToSnapshot(IntPtr, IntPtr, int, int, IntPtr, int, int, TSerializer)

    Copy the dynamic buffers content to the snapshot, using the serializer strategy.

    Declaration
    public static void CopyBuffersToSnapshot(IntPtr stateData, IntPtr snapshotData, int snapshotOffset, int snapshotStride, IntPtr componentData, int componentStride, int count, TSerializer serializer)
    Parameters
    Type Name Description
    IntPtr stateData

    a pointer to the GhostSerializerState struct

    IntPtr snapshotData

    the snapshot buffer

    int snapshotOffset

    the current offset in the snapshot buffer

    int snapshotStride

    the stride to apply to snapshot pointer for each individual entity

    IntPtr componentData

    a pointer to the chunk component data

    int componentStride

    the stride to apply to component pointer for each individual entity

    int count

    the number of entities

    TSerializer serializer

    the IGhostSerialized instance used to serialize the buffer content

    PostSerializeBuffers(IntPtr, int, int, int, int, int, IntPtr, ref DataStreamWriter, StreamCompressionModel, IntPtr, IntPtr, IntPtr, int, TSerializer)

    Copy the pre-serialized dynamic buffer data to data stream writer using the serializer strategy.

    Declaration
    public static void PostSerializeBuffers(IntPtr snapshotData, int snapshotOffset, int snapshotStride, int maskOffsetInBits, int changeMaskBits, int count, IntPtr baselines, ref DataStreamWriter writer, StreamCompressionModel compressionModel, IntPtr entityStartBit, IntPtr snapshotDynamicDataPtr, IntPtr dynamicSizePerEntity, int dynamicSnapshotMaxOffset, TSerializer serializer)
    Parameters
    Type Name Description
    IntPtr snapshotData

    the snapshot buffer

    int snapshotOffset

    the current offset in the snapshot buffer

    int snapshotStride

    the stride to apply to each individual entity

    int maskOffsetInBits

    the offset in the changemask bit array

    int changeMaskBits

    the changemask bit array

    int count

    the number of entities

    IntPtr baselines

    the baselines for each entity

    DataStreamWriter writer

    the output data stream

    StreamCompressionModel compressionModel

    the compression model used to compressed the stream

    IntPtr entityStartBit

    an array of start/end offset in the data stream, that denote for each individual component where their compressed data is stored in the data stream.

    IntPtr snapshotDynamicDataPtr

    storage for the buffer snapshot

    IntPtr dynamicSizePerEntity

    the total buffer size (in bytes) written into the snapshot buffer for each entity.

    int dynamicSnapshotMaxOffset

    the dynamic snapshot buffer capacity

    TSerializer serializer

    the IGhostSerialized instance used to serialize the buffer content

    SerializeBuffers(IntPtr, IntPtr, int, int, int, int, IntPtr, IntPtr, int, IntPtr, ref DataStreamWriter, StreamCompressionModel, IntPtr, IntPtr, ref int, IntPtr, int, TSerializer)

    Serialize the dynamic buffer content to the writer stream using the serializer strategy.

    Declaration
    public static void SerializeBuffers(IntPtr stateData, IntPtr snapshotData, int snapshotOffset, int snapshotStride, int maskOffsetInBits, int changeMaskBits, IntPtr componentData, IntPtr componentDataLen, int count, IntPtr baselines, ref DataStreamWriter writer, StreamCompressionModel compressionModel, IntPtr entityStartBit, IntPtr snapshotDynamicDataPtr, ref int dynamicSnapshotDataOffset, IntPtr dynamicSizePerEntity, int dynamicSnapshotMaxOffset, TSerializer serializer)
    Parameters
    Type Name Description
    IntPtr stateData

    a pointer to the GhostSerializerState struct

    IntPtr snapshotData

    the snapshot buffer

    int snapshotOffset

    the current offset in the snapshot buffer

    int snapshotStride

    the stride to apply to each individual entity

    int maskOffsetInBits

    the offset in the changemask bit array

    int changeMaskBits

    the changemask bit array

    IntPtr componentData

    a pointer to the chunk component data

    IntPtr componentDataLen

    the len of each individual buffer

    int count

    the number of entities

    IntPtr baselines

    the baselines for each entity

    DataStreamWriter writer

    the output data stream

    StreamCompressionModel compressionModel

    the compression model used to compressed the stream

    IntPtr entityStartBit

    an array of start/end offset in the data stream, that denote for each individual component where their compressed data is stored in the data stream.

    IntPtr snapshotDynamicDataPtr

    storage for the buffer snapshot

    int dynamicSnapshotDataOffset

    the current offset in the dynamic snapshot buffer

    IntPtr dynamicSizePerEntity

    the total buffer size (in bytes) written into the snapshot buffer for each entity.

    int dynamicSnapshotMaxOffset

    the dynamic snapshot buffer capacity

    TSerializer serializer

    the IGhostSerialized instance used to serialize the buffer content

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)