docs.unity3d.com
    Show / Hide Table of Contents

    Interface ICommandDataSerializer<T>

    Interface that must be implemented to serialize/deserialize ICommandData. Usually commands serialization / deserialization is automatically generated, unless a NetCodeDisableCommandCodeGenAttribute is added to the command struct to opt-in for manual serializaton. If you enable manual serializaton, you must create a public struct that implement the ICommandDataSerializer for your type, as well as the necessary send and received systems in order to have your RPC sent and received.

    Namespace: Unity.NetCode
    Syntax
    public interface ICommandDataSerializer<T>
        where T : struct, ICommandData
    Type Parameters
    Name Description
    T

    Methods

    Deserialize(ref DataStreamReader, in RpcDeserializerState, ref T)

    Deserialize a single command from the data stream.

    Declaration
    void Deserialize(ref DataStreamReader reader, in RpcDeserializerState state, ref T data)
    Parameters
    Type Name Description
    DataStreamReader reader

    An instance of a DataStreamWriter

    RpcDeserializerState state

    An instance of RpcSerializerState used to carry some additional data and accessor for serializing the command field type. In particular, used to serialize entity

    T data

    Deserialize(ref DataStreamReader, in RpcDeserializerState, ref T, in T, StreamCompressionModel)

    Deserialize a single command from the data stream using delta compression

    Declaration
    void Deserialize(ref DataStreamReader reader, in RpcDeserializerState state, ref T data, in T baseline, StreamCompressionModel compressionModel)
    Parameters
    Type Name Description
    DataStreamReader reader

    An instance of a DataStreamWriter

    RpcDeserializerState state

    An instance of RpcSerializerState used to carry some additional data and accessor for serializing the command field type. In particular, used to serialize entity

    T data
    T baseline
    StreamCompressionModel compressionModel

    Serialize(ref DataStreamWriter, in RpcSerializerState, in T)

    Serialize the command to the data stream.

    Declaration
    void Serialize(ref DataStreamWriter writer, in RpcSerializerState state, in T data)
    Parameters
    Type Name Description
    DataStreamWriter writer

    An instance of a DataStreamWriter

    RpcSerializerState state

    An instance of RpcSerializerState used to carry some additional data and accessor for serializing the command field type. In particular, used to serialize entity

    T data

    Serialize(ref DataStreamWriter, in RpcSerializerState, in T, in T, StreamCompressionModel)

    Serialize the command to the data stream using delta compression.

    Declaration
    void Serialize(ref DataStreamWriter writer, in RpcSerializerState state, in T data, in T baseline, StreamCompressionModel compressionModel)
    Parameters
    Type Name Description
    DataStreamWriter writer

    An instance of a DataStreamWriter

    RpcSerializerState state

    An instance of RpcSerializerState used to carry some additional data and accessor for serializing the command field type. In particular, used to serialize entity

    T data
    T baseline
    StreamCompressionModel compressionModel
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023