docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct NetworkSnapshotAck

    Client and Server Component. One per NetworkId entity, stores SnapshotAck and Ping info for a client.

    Implements
    IComponentData
    IQueryTypeParameter
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    public struct NetworkSnapshotAck : IComponentData, IQueryTypeParameter

    Fields

    CommandArrivalStatistics

    Declaration
    public CommandArrivalStatistics CommandArrivalStatistics
    Field Value
    Type Description
    CommandArrivalStatistics

    CurrentSnapshotSequenceId

    Client: Records the last Snapshot Sequence Id received by this client.

    Server: Increments every time a Snapshot is successfully dispatched (thus, assumed sent).

    SnapshotPacketLoss

    Declaration
    public byte CurrentSnapshotSequenceId
    Field Value
    Type Description
    byte

    DeviationRTT

    The round trip time average deviation from the EstimatedRTT. It is not a real standard deviation but an approximation using a simpler exponential smoothing average.

    Declaration
    public float DeviationRTT
    Field Value
    Type Description
    float

    EstimatedRTT

    The calculated exponential smoothing average connection round trip time.

    Declaration
    public float EstimatedRTT
    Field Value
    Type Description
    float

    FirstReceivedSnapshotByRemote

    Denotes the first valid snapshot received by the remote connection. Only used to safeguard snapshot acking against the client's 'reset all ack-masks' logic.

    Declaration
    public NetworkTick FirstReceivedSnapshotByRemote
    Field Value
    Type Description
    NetworkTick

    LastReceiveTimestamp

    The local time stamp at which the connection has received the last message. Used to calculate the elapsed "processing" time and reported to the remote peer to correctly update the round trip time.

    Declaration
    public uint LastReceiveTimestamp
    Field Value
    Type Description
    uint

    LastReceivedRemoteTime

    The last remote time stamp received by the connection. The remote time is sent back (via command for the client or in the snapshot for the server) and used to calculate the round trip time for the connection.

    Declaration
    public uint LastReceivedRemoteTime
    Field Value
    Type Description
    uint

    LastReceivedSnapshotByLocal

    The field has a different meaning on the client vs on the server:

    Client: it is the last received ghost snapshot from the server.

    Server: record the last command tick that has been received. Used to discard either out of order or late commands.

    Declaration
    public NetworkTick LastReceivedSnapshotByLocal
    Field Value
    Type Description
    NetworkTick

    LastReceivedSnapshotByRemote

    The last snapshot (tick) received from the remote peer.

    For the client, it represents the last received snapshot received from the server.

    For the server, it is the last acknowledge packet that has been received by client.

    Declaration
    public NetworkTick LastReceivedSnapshotByRemote
    Field Value
    Type Description
    NetworkTick

    NumLoadedPrefabs

    Server-only, the number of ghost prefabs loaded by remote client. On the client is not used and it is always 0.

    Declaration
    public uint NumLoadedPrefabs
    Field Value
    Type Description
    uint

    ReceivedSnapshotByLocalMask

    Client-only, a bitmask that indicates which of the last 32 snapshots has been received from the server. On the server it is always 0.

    Declaration
    public uint ReceivedSnapshotByLocalMask
    Field Value
    Type Description
    uint

    RemoteInterpolationDelay

    The reported interpolation delay reported by the client (in number of ticks).

    Declaration
    public uint RemoteInterpolationDelay
    Field Value
    Type Description
    uint

    ServerCommandAge

    How late the commands are received by server. Is a negative fixedPoint Q24:8 number that measure how many ticks behind the server was when he received the command, and it used as feedback by the NetworkTimeSystem to synchronize the ServerTick such that the client always runs ahead of the server. A positive number indicates that the client is running behind the server. A negative number indicates that the client is running ahead of the server.

    Declaration
    public int ServerCommandAge
    Field Value
    Type Description
    int

    SnapshotPacketLoss

    Stores packet loss causes and statistics for all received snapshots. Thus, client-only (with one exception). Access via NetworkSnapshotAck.

    Declaration
    public SnapshotPacketLossStatistics SnapshotPacketLoss
    Field Value
    Type Description
    SnapshotPacketLossStatistics
    Remarks

    Very similar approach to Unity.Networking.Transport.UnreliableSequencedPipelineStage Statistics.

    Methods

    IsReceivedByRemote(NetworkTick)

    Return true if the snapshot for tick tick has been received (from a client perspective) or acknowledged (from the servers POV).

    Declaration
    public bool IsReceivedByRemote(NetworkTick tick)
    Parameters
    Type Name Description
    NetworkTick tick

    Tick to query.

    Returns
    Type Description
    bool

    Whether the snapshot for tick tick has been received (from a client perspective) or acknowledged (from the servers POV).

    IsReceivedByRemote(NetworkTick, bool)

    Return true if the snapshot for tick tick has been received (from a client perspective) or acknowledged (from the servers POV).

    Declaration
    public bool IsReceivedByRemote(NetworkTick tick, bool backupValue)
    Parameters
    Type Name Description
    NetworkTick tick

    Tick to query.

    bool backupValue

    Denotes the historic value to use if the real answer is now unknowable. Pragmatically, this can only occur for extremely rarely sent static-optimized ghosts.

    Returns
    Type Description
    bool

    Whether the snapshot for tick tick has been received (from a client perspective) or acknowledged (from the servers POV).

    Implements

    Unity.Entities.IComponentData
    Unity.Entities.IQueryTypeParameter
    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)