UNet LLAPI issue on Unity 5.6.0f3

Hi there,

I’m having trouble with UNet spitting out errors in the console after suspending the player (window loses focus).

I managed to strip down all my networking code to just the connect/disconnect/message handling in order to catch the culprit.

I have an empty scene with a single component that starts a server as well as a client and connects them (using LLAPI/Network Transport) and sends the client a random message every second. This works great until the app loses focus.

On iOS, if the app loses focus (iOS native popup, for example), errors will spam the console.
In the Editor, this can be reproduced by simply clicking out of the Unity Editor window, then clicking back in (it happens about 60% of the time).

Here’s my code:

Steps to reproduce:

  • Create a new project in Unity 5.6.0f3.
  • Create a new GameObject and drag the UNetTest component onto it.
  • Play and click “Start Server” and “Start Client” in the Game view.
  • Click out of the Unity Editor window then back into it (lose then regain focus).

The console spits out this warning:

“Application has been suspended, all multiplayer features will re-init”

Then the following error:

“host id out of bound id {0} max id should be greater 0 and less than {0}”

I did a little more testing… It seems if I enable the PlayerSettings/Standalone/Run In Background, this no longer happens, but what about iOS? How do I prevent this from happening on mobile devices, in general? Am I missing some clean-up code?

I have the same error,I guess It’s should be unity internal bug.

Guys, just fixed couple days ago. Fix is waiting for submit…

sorry about this :frowning:

Any news about that? What is the ticket/issue-URL?

I’d also like to know. Thanks.

It appears to be this issue: Unity Issue Tracker - [Networking] Console is flooding with "host id out of bound id {0} max id should be greater 0 and less than {0}" when connected