docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IGhostSerializer<TComponent, TSnapshot>

    Interface implemented by all the component/buffer serialiser. For internal use only.

    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    [RequireImplementors]
    [Obsolete("The IGhostSerializer<TComponent, TSnapshot> has been deprecated. Please use the IGhostComponentSerializer instead")]
    public interface IGhostSerializer<TComponent, TSnapshot> where TComponent : unmanaged where TSnapshot : unmanaged
    Type Parameters
    Name Description
    TComponent

    The component type that this interface serialize.

    TSnapshot

    The snapshot struct type that will contains the component data.

    Methods

    CalculateChangeMaskGenerated(in TSnapshot, in TSnapshot, IntPtr, int)

    Compute the change mask for the snapshot in respect to the given baseline

    Declaration
    void CalculateChangeMaskGenerated(in TSnapshot snapshot, in TSnapshot baseline, IntPtr changeMaskData, int startOffset)
    Parameters
    Type Name Description
    TSnapshot snapshot

    Snapshot reference

    TSnapshot baseline

    Snapshot baseline

    IntPtr changeMaskData

    Change mask data

    int startOffset

    Start offset

    CopyFromSnapshotGenerated(in GhostDeserializerState, ref TComponent, float, float, in TSnapshot, in TSnapshot)

    Copy/Convert the data form the snapshot to the component. Support interpolation and extrapolation.

    Declaration
    void CopyFromSnapshotGenerated(in GhostDeserializerState serializerState, ref TComponent component, float interpolationFactor, float snapshotInterpolationFactorRaw, in TSnapshot snapshotBefore, in TSnapshot snapshotAfter)
    Parameters
    Type Name Description
    GhostDeserializerState serializerState

    Serializer state

    TComponent component

    Component

    float interpolationFactor

    Interpolation factor

    float snapshotInterpolationFactorRaw

    Snapshot interpolation factor

    TSnapshot snapshotBefore

    Snapshot before

    TSnapshot snapshotAfter

    Snapshot after

    CopyToSnapshotGenerated(in GhostSerializerState, ref TSnapshot, in TComponent)

    Copy/Convert the component data to the snapshot.

    Declaration
    void CopyToSnapshotGenerated(in GhostSerializerState serializerState, ref TSnapshot snapshot, in TComponent component)
    Parameters
    Type Name Description
    GhostSerializerState serializerState

    Serializer state

    TSnapshot snapshot

    Snapshot reference

    TComponent component

    Component

    DeserializeGenerated(ref DataStreamReader, in StreamCompressionModel, IntPtr, int, ref TSnapshot, in TSnapshot)

    Read the data from the reader stream into the snapshot data.

    Declaration
    void DeserializeGenerated(ref DataStreamReader reader, in StreamCompressionModel compressionModel, IntPtr changeMask, int startOffset, ref TSnapshot snapshot, in TSnapshot baseline)
    Parameters
    Type Name Description
    DataStreamReader reader

    Data stream reader

    StreamCompressionModel compressionModel

    Compression model

    IntPtr changeMask

    Change mask

    int startOffset

    Starting offset

    TSnapshot snapshot

    Snapshot reference

    TSnapshot baseline

    Snapshot baseline

    PredictDeltaGenerated(ref TSnapshot, in TSnapshot, in TSnapshot, ref GhostDeltaPredictor)

    Calculate the predicted baseline.

    Declaration
    void PredictDeltaGenerated(ref TSnapshot snapshot, in TSnapshot baseline1, in TSnapshot baseline2, ref GhostDeltaPredictor predictor)
    Parameters
    Type Name Description
    TSnapshot snapshot

    Snapshot reference

    TSnapshot baseline1

    Snapshot baseline

    TSnapshot baseline2

    Snapshot baseline

    GhostDeltaPredictor predictor

    Delta predictor

    ReportPredictionErrorsGenerated(in TComponent, in TComponent, IntPtr, int)

    Calculate the prediction error for this component.

    Declaration
    void ReportPredictionErrorsGenerated(in TComponent component, in TComponent backup, IntPtr errorsList, int errorsCount)
    Parameters
    Type Name Description
    TComponent component

    Component

    TComponent backup

    Backup buffer

    IntPtr errorsList

    Data for errors

    int errorsCount

    Error count

    RestoreFromBackupGenerated(ref TComponent, in TComponent)

    Restore the component data from the prediction backup buffer. Only serialised fields are restored.

    Declaration
    void RestoreFromBackupGenerated(ref TComponent component, in TComponent backup)
    Parameters
    Type Name Description
    TComponent component

    Component

    TComponent backup

    Backup buffer

    SerializeCombinedGenerated(in TSnapshot, in TSnapshot, IntPtr, int, ref DataStreamWriter, in StreamCompressionModel)

    Serialise the snapshot dato to the writer based on the calculated changemask.

    Declaration
    void SerializeCombinedGenerated(in TSnapshot snapshot, in TSnapshot baseline, IntPtr changeMaskData, int startOffset, ref DataStreamWriter writer, in StreamCompressionModel compressionModel)
    Parameters
    Type Name Description
    TSnapshot snapshot

    Snapshot reference

    TSnapshot baseline

    Snapshot baseline

    IntPtr changeMaskData

    Change mask data

    int startOffset

    Start offset

    DataStreamWriter writer

    Datastream writer

    StreamCompressionModel compressionModel

    Compression model

    SerializeGenerated(in TSnapshot, in TSnapshot, IntPtr, int, ref DataStreamWriter, in StreamCompressionModel)

    Serialise the snapshot dato to the writer based on the calculated changemask.

    Declaration
    void SerializeGenerated(in TSnapshot snapshot, in TSnapshot baseline, IntPtr changeMaskData, int startOffset, ref DataStreamWriter writer, in StreamCompressionModel compressionModel)
    Parameters
    Type Name Description
    TSnapshot snapshot

    Snapshot reference

    TSnapshot baseline

    Snapshot baseline

    IntPtr changeMaskData

    Change mask data

    int startOffset

    Start offset

    DataStreamWriter writer

    Datastream writer

    StreamCompressionModel compressionModel

    Compression model

    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)