Random disconnections while using UNET

In order to see a possible worst case scenario, I tried hosting my game and then connecting to it from a tethered computer on a cellular hotspot. I saw that it disconnected pretty fast, although it seemed like it was a stable enough connection. I then went to simulate lag on my computer (running two instances, I’ve used both Unity’s network simulator and Clumsy), and found that even with only 1% packet loss it disconnected.

I’ve then tried browsing everywhere I can, and haven’t gotten any solid idea on why this happens (the bugs in the Unity bug tracker are all flagged as “By Design”). My timeout values are set pretty high, 10 seconds set for disconnect and 5 seconds for ping timeout. I honestly can’t see how the Unity team can expect a completely rock solid connection, unless they expect UNET to work only for LAN.

Why does this happen and what can I do to fix it?

I know this isn’t really any answer, but I just wanted to post and say you’re not crazy, I’m seeing this too and its a real problem. ANY amount of packet loss leads to disconnect with UNET.

You are indeed not crazy! I have exactly the same problem. Seems to be a mystery.

In your Network Manager, set your Max Delay to 0.1 or higher instead of the default 0.01

In NetworkManager’s Advanced Configurations increase Disconnect timeout and Ping timeout as per you need

This may help to solve the problem