I built a multiplayer game and it works fine in the editor for disconnecting and reconnecting, but in the build it crashes every time I try to disconnect. Im using unity 5.4.1f1
Here’s the disconnect code
public void Disconnect()
{
if(m_Connected == true)
{
// Close down the connection
if (this.networkStream != null)
this.networkStream.Close();
if (this.tcpClient != null)
this.tcpClient.Close();
if (this.clientSocket != null)
this.clientSocket.Close();
// Clean up the connection state
this.networkStream = null;
this.tcpClient = null;
this.clientSocket = null;
this.m_Connected = false;
}
}