docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct NetworkStreamConnection

    A connection is represented by an entity having a NetworkStreamConnection. The component hold a reference to the underlying transport Unity.Networking.Transport.NetworkConnection and the Unity.Networking.Transport.NetworkDriver that created it. All connections share a common set of components:

    - NetworkId

    - IncomingRpcDataStreamBuffer

    - OutgoingCommandDataStreamBuffer

    - OutgoingRpcDataStreamBuffer

    - PrespawnSectionAck

    - CommandTarget

    Client connections also have a IncomingSnapshotDataStreamBuffer to handle server ghost snapshots.

    Implements
    ICleanupComponentData
    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 NetworkStreamConnection : ICleanupComponentData, IComponentData, IQueryTypeParameter
    Remarks

    Never destroy this entity yourself. You'll receive an error if you attempt to do so.

    Fields

    CurrentState

    Cache of the last state pulled from the driver.

    Declaration
    public ConnectionState.State CurrentState
    Field Value
    Type Description
    ConnectionState.State
    Remarks

    May be stale, as only refreshed once per Unity.Entities.SimulationSystemGroup tick.

    DriverId

    The driver identifier that create the connection. Can be used to retrieve the Unity.Networking.Transport.NetworkDriver or the NetworkDriverStore.NetworkDriverInstance from the NetworkDriverStore.

    Declaration
    public int DriverId
    Field Value
    Type Description
    int

    ProtocolVersionReceived

    Flag used to mark if the connection has exchanged the protocol version. 1 indicates that the remote version protocol has been received AND accepted (i.e. it's valid)!

    Declaration
    public int ProtocolVersionReceived
    Field Value
    Type Description
    int

    Value

    The underlying transport Unity.Networking.Transport.NetworkConnection

    Declaration
    public NetworkConnection Value
    Field Value
    Type Description
    NetworkConnection

    Implements

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