Called on client during disconnection from server, but also on the server when the connection has disconnected.
function OnDisconnectedFromServer(info : NetworkDisconnection) { if (Network.isServer) { Debug.Log("Local server connection disconnected"); } else { if (info == NetworkDisconnection.LostConnection) Debug.Log("Lost connection to the server"); else Debug.Log("Successfully diconnected from the server"); } }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void OnDisconnectedFromServer(NetworkDisconnection info) { if (Network.isServer) Debug.Log("Local server connection disconnected"); else if (info == NetworkDisconnection.LostConnection) Debug.Log("Lost connection to the server"); else Debug.Log("Successfully diconnected from the server"); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def OnDisconnectedFromServer(info as NetworkDisconnection) as void: if Network.isServer: Debug.Log('Local server connection disconnected') elif info == NetworkDisconnection.LostConnection: Debug.Log('Lost connection to the server') else: Debug.Log('Successfully diconnected from the server')