When I quit the main game scene where a server is active and the player is connected, I want to make sure that it disconnects and the server is also shut down so no-one can connect to an unplayable server.
I use the code bellow every time I quit the game scene.
public static void StopNetworkActivity()
{
TNManager.Disconnect();
TNManager.CloseChannel();
if (TNServerInstance.isActive)
{
TNServerInstance.Stop();
}
}
When connected with another player, it sometimes freezes the whole thing, on any platform (iOS, android, PC or Unity Editor)
Am I doing something wrong by misusing the code above or is it something from TNet or .Net itself ?
Anyone else experienced freezing due to TNet code ?