UNET: Host freezes when more than 6 players are connected.

I am trying to learn Unity networking for my multiplayer game project. I used TANKS! Networking Demo as a reference and was able to build my own working demo. Everything is working properly except when the number of players exceeds six (6).

One device acts as host and other players connect as clients. When the total number of players including host is six or less than six, everything works properly. But as soon as the 7th player tries to connect to host, the host freezes and the game stops responding. Also checked the Tanks Networking demo and that project has the same issue as well.

I tried to tweak LobbyManager properties Max Players, Max connections(under Advanced Configuration) from inspector but the result is same.

Any help on the issue will be much appreciated. I’ve done all I could but didn’t find any solution for the issue.

Thanks

Hello @Brijs ,

I know it has been a while now and you probably already found a solution for this.
But for others trying to find a fix for this problem, I assume you are using the Lobby Manager Example.

The class LobbyPlayer uses colors and each player will have an unique color when entering the lobby, however there are only 6 colors that are available. So you will run into problems the moment you connect the 7th player since the server is unable to assign a color that is not used yet. This is quickly fixed by adding more colors to the Color Colors in LobbyPlayer, I have a maximum of 8 players so I just added 2 more colors like this:

static Color[] Colors = new Color[] { Color.magenta, Color.red, Color.cyan, Color.blue, Color.green, Color.yellow, Color.black, Color.white };

This line of code is found at the top of the LobbyPlayer class.
I hope this is helpful to someone.