docs.unity3d.com
    Show / Hide Table of Contents

    Class NetworkConnectionManager

    The NGO connection manager handles:

    • Client Connections
    • Client Approval
    • Processing NetworkEvents.
    • Client Disconnection
    Inheritance
    Object
    NetworkConnectionManager
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Netcode
    Syntax
    public sealed class NetworkConnectionManager

    Properties

    DisconnectReason

    When disconnected from the server, the server may send a reason. If a reason was sent, this property will tell client code what the reason was. It should be queried after the OnClientDisconnectCallback is called

    Declaration
    public string DisconnectReason { get; }
    Property Value
    Type Description
    String

    IsListening

    Is true when a server or host is listening for connections. Is true when a client is connecting or connected to a network session. Is false when not listening, connecting, or connected.

    Declaration
    public bool IsListening { get; }
    Property Value
    Type Description
    Boolean

    Events

    OnClientConnectedCallback

    The callback to invoke once a client connects. This callback is only ran on the server and on the local client that connects.

    Declaration
    public event Action<ulong> OnClientConnectedCallback
    Event Type
    Type Description
    Action<UInt64>

    OnClientDisconnectCallback

    The callback to invoke when a client disconnects. This callback is only ran on the server and on the local client that disconnects.

    Declaration
    public event Action<ulong> OnClientDisconnectCallback
    Event Type
    Type Description
    Action<UInt64>

    OnTransportFailure

    The callback to invoke if the NetworkTransport fails.

    Declaration
    public event Action OnTransportFailure
    Event Type
    Type Description
    Action
    Remarks

    A failure of the transport is always followed by the Unity.Netcode.NetworkConnectionManager.NetworkManager shutting down. Recovering from a transport failure would normally entail reconfiguring the transport (e.g. re-authenticating, or recreating a new service allocation depending on the transport) and restarting the client/server/host.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023