docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ComponentSerializationHelper<TComponentType, TSnapshot, TSerializer>

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

    Inheritance
    object
    ComponentSerializationHelper<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 ComponentSerializationHelper<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

    CopyComponentsFromSnapshot(IntPtr, IntPtr, int, int, IntPtr, int, int, TSerializer)

    Copy the component data from the snapshot buffer using the serializer strategy.

    Declaration
    public static void CopyComponentsFromSnapshot(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

    CopyComponentsToSnapshot(IntPtr, IntPtr, int, int, IntPtr, int, int, TSerializer)

    Copy component data to the snapshot buffer using the serializer strategy.

    Declaration
    public static void CopyComponentsToSnapshot(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

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

    For internal use by source generator, write pre-serialized components data to the writer stream.

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

    the IGhostSerialized instance used to serialize the buffer content

    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 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.

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

    For internal use by source generator, copy the component data to the snapshot, calculate the change masks, and write the delta compressed snapshot data to the writer stream.

    Declaration
    public static void SerializeComponents(TSerializer serializer, IntPtr stateData, IntPtr snapshotData, int snapshotOffset, int snapshotStride, int maskOffsetInBits, IntPtr componentData, int count, IntPtr baselines, ref DataStreamWriter writer, StreamCompressionModel compressionModel, IntPtr entityStartBit)
    Parameters
    Type Name Description
    TSerializer serializer

    the IGhostSerialized instance used to serialize the buffer content

    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

    IntPtr componentData

    a pointer to the chunk component data

    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.

    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)