docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Enum NetworkStreamDisconnectReason

    Reasons for a Unity.Networking.Transport.NetworkEvent.Type.Disconnect event. This can be obtained by reading a single byte off the DataStreamReader obtained when calling PopEvent(out NetworkConnection, out DataStreamReader) when the popped event is for a disconnection.

    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    public enum NetworkStreamDisconnectReason
    Remarks

    Maps directly to Unity.Networking.Transport.Error.DisconnectReason, with NetCode specific additions.

    Fields

    Name Description
    ApprovalFailure

    NetCode-specific: Denotes that the client has failed approval, by inputting invalid credentials.

    ApprovalTimeout

    NetCode-specific: Denotes that the client has failed to be approved by the server within the given HandshakeApprovalTimeoutMS.

    AuthenticationFailure

    Indicates the connection failed to be established because the remote peer could not be authenticated. This can only occur if using DTLS or TLS (with WebSockets).

    BadProtocolVersion

    NetCode-specific: Denotes that we've detected an unknown or unexpected ghost hash, implying that this is an incompatible server/client pair.

    ClosedByRemote

    Indicates the connection was manually closed by the remote peer.

    ConnectionClose

    Internal value. Do not use.

    HandshakeTimeout

    NetCode-specific: Denotes that the client's internal netcode logic has failed to send the RequestProtocolVersionHandshake to the server within the given HandshakeApprovalTimeoutMS.

    InvalidRpc

    NetCode-specific: Denotes that we've detected a hash miss-match in an RPC, or an unknown RPC. Implies that this is an incompatible server/client pair.

    MaxConnectionAttempts

    Indicates the connection failed to be established because the server could not be reached (see Unity.Networking.Transport.NetworkConfigParameter.maxConnectAttempts).

    ProtocolError

    Indicates the connection failed because of a low-level protocol error (unexpected socket error, malformed payload in a TCP stream, etc.). This denotes an error that is both unexpected and that can't be recovered from. As such it should not be returned under normal operating circumstances.

    Timeout

    Indicates the connection timed out due to inactivity.

    Extension Methods

    NetCodeUtils.ToFixedString(NetworkStreamDisconnectReason)
    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)