docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class NetCodeUtils

    ToFixedString utilities for enums.

    Inheritance
    object
    NetCodeUtils
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    public static class NetCodeUtils

    Methods

    ToFixedString(State)

    Returns the Fixed String enum value name.

    Declaration
    public static FixedString32Bytes ToFixedString(this ConnectionState.State state)
    Parameters
    Type Name Description
    ConnectionState.State state

    The source enum.

    Returns
    Type Description
    FixedString32Bytes

    Returns the Fixed String enum value name.

    ToFixedString(NetworkStreamDisconnectReason)

    Returns the Fixed String enum value name.

    Declaration
    public static FixedString32Bytes ToFixedString(this NetworkStreamDisconnectReason reason)
    Parameters
    Type Name Description
    NetworkStreamDisconnectReason reason

    The source enum.

    Returns
    Type Description
    FixedString32Bytes

    Returns the Fixed String enum value name.

    ToFixedString(State)

    Returns the Fixed String enum value name.

    Declaration
    public static FixedString32Bytes ToFixedString(this NetworkConnection.State state)
    Parameters
    Type Name Description
    NetworkConnection.State state

    The source enum.

    Returns
    Type Description
    FixedString32Bytes

    Returns the Fixed String enum value name.

    ToNetcodeState(State, bool, bool)

    Converts from the Transport state to ours.

    Declaration
    public static ConnectionState.State ToNetcodeState(this NetworkConnection.State transportState, bool hasHandshaked, bool hasApproval = true)
    Parameters
    Type Name Description
    NetworkConnection.State transportState

    The source enum.

    bool hasHandshaked

    True if the handshake process has been completed.

    bool hasApproval

    True if (we have been approved AND the approval flow is enabled) OR if we don't need approval.

    Returns
    Type Description
    ConnectionState.State

    Netcode connection state

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    If transport state is unknown.

    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)