/// <summary>Disconnects the client and stops all network traffic.</summary> public void Disconnect() { Log($"{tcp.socket.Client.RemoteEndPoint} has disconnected from the server."); ThreadManager.ExecuteOnMainThread(() => { UnityEngine.Object.Destroy(player.gameObject); player = null; }); tcp.Disconnect(); udp.Disconnect(); ServerSend.PlayerDisconnected(id); Log("Disconnected on Server Side."); }