docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct NetworkId

    The connection identifier assigned by the server to the incoming client connection. The NetworkIdComponent is used as temporary client identifier for the current session. When a client disconnects, its network id can be reused by the server, and assigned to a new, incoming connection (on a a "first come, first serve" basis). Thus, there is no guarantee that a disconnecting client will receive the same network id once reconnected. As such, the network identifier should never be used to persist - and then retrieve - information for a given client/player.

    Implements
    IComponentData
    IQueryTypeParameter
    IEquatable<NetworkId>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    public struct NetworkId : IComponentData, IQueryTypeParameter, IEquatable<NetworkId>

    Fields

    Value

    The network identifier assigned by the server. A valid identifier it is always greater than 0.

    Declaration
    public int Value
    Field Value
    Type Description
    int

    Methods

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    ValueType.Equals(object)

    Equals(NetworkId)

    Declaration
    public bool Equals(NetworkId other)
    Parameters
    Type Name Description
    NetworkId other
    Returns
    Type Description
    bool

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    ValueType.GetHashCode()

    ToFixedString()

    Returns 'NID[value]'.

    Declaration
    public FixedString32Bytes ToFixedString()
    Returns
    Type Description
    FixedString32Bytes

    Returns 'NID[value]'.

    Operators

    operator ==(NetworkId, NetworkId)

    Declaration
    public static bool operator ==(NetworkId left, NetworkId right)
    Parameters
    Type Name Description
    NetworkId left
    NetworkId right
    Returns
    Type Description
    bool

    operator !=(NetworkId, NetworkId)

    Declaration
    public static bool operator !=(NetworkId left, NetworkId right)
    Parameters
    Type Name Description
    NetworkId left
    NetworkId right
    Returns
    Type Description
    bool

    Implements

    IComponentData
    IQueryTypeParameter
    IEquatable<T>
    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)