Search Unity

UNet LLAPI issue on Unity 5.6.0f3

Discussion in 'UNet' started by Sour, May 3, 2017.

  1. Sour

    Sour

    Joined:
    Apr 14, 2013
    Posts:
    24
    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:
    https://pastebin.com/7SHu6LcP

    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?
     
  2. lifeFo

    lifeFo

    Joined:
    Apr 14, 2017
    Posts:
    15
    I have the same error,I guess It's should be unity internal bug.
     
  3. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Guys, just fixed couple days ago. Fix is waiting for submit...

    sorry about this :(
     
  4. vOwl

    vOwl

    Joined:
    Jul 6, 2013
    Posts:
    8
    Any news about that? What is the ticket/issue-URL?
     
  5. Adam-VisualVocal

    Adam-VisualVocal

    Joined:
    Sep 22, 2016
    Posts:
    10
    I'd also like to know. Thanks.
     
  6. Richard_Wildcard

    Richard_Wildcard

    Joined:
    Feb 14, 2017
    Posts:
    1