Players are disconnected (I think?) randomly

Let me preface this by saying this ONLY happens with the built game, and NEVER inside of unity.
At random points, players are reporting that everything disappears (their character, everybody else's character etc).
I have observed this happen as well.

This will ONLY happen to people who are running the game outside of unity.
It is pretty hard to debug because of this. What could be going on here? Is there some code I can plop into the game to see if it corrects the issue?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @RacerDelux,

    I think you need to implement disconnection callback and log the disconnect cause OR display it to the user in some nice text message in the UI.
    Other information that could be used are: the protocol used, region, server address, etc.

    Read more about "Analyzing Disconnects".
  • Is it normal for one to have no disconnection issues in editor?
    Like does the editor have some disconnection callbacks defined as default or something?
  • @JohnTube
    So I have been testing this.... it is VERY confusing and VERY hard to debug. If I build the game as a "development build", the disconnect NEVER happens. I really think this seems like a bug in PUN.

    The disconnect reason it is giving me is "Client Timeout"

  • Also the game deletes all of the assets spawned by that client... I need that not to happen. Is there anything built in that says "Don't destroy me"?
  • Even more so, I set the background keep alive to 400 seconds. I timed out in about 23 seconds while actively moving.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @RacerDelux,

    Is it normal for one to have no disconnection issues in editor?
    Like does the editor have some disconnection callbacks defined as default or something?

    Maybe the Unity Editor and the build are not connected to the same network or to the same region?
    Are you running the build on the same machine as the Unity Editor?
    If you are using "Best Region", try to change that to an explicit Fixed Region.
    Maybe the Unity Editor is connected to the closest region and the build is connected to another region.
    Also maybe since you use the client build while joined more than the Unity Editor it could be the reason why you think disconnects happen more often in the client build.

    Otherwise, PUN does not delete anything and is not affected by the "development build" setting of Unity.
  • RacerDelux
    edited September 2019
    @JohnTube
    JohnTube said:


    Maybe the Unity Editor and the build are not connected to the same network or to the same region?

    Region is hard coded to USW.
    JohnTube said:


    Also maybe since you use the client build while joined more than the Unity Editor it could be the reason why you think disconnects happen more often in the client build.

    So I actually managed to get this to happen with only having a single player in the game. If I join and just run around for a minute, it eventually disconnects me.
    JohnTube said:


    Otherwise, PUN does not delete anything and is not affected by the "development build" setting of Unity.

    I managed to get to the point where I reconnect and rejoin room, but the character that I spawned before disconnecting is gone. I even set the ttl to -1 which I am pretty sure means it is not supposed to touch anything until the gamettl is up right? (I set that to 50 seconds).

    I managed to get an in game console running so I could see the error codes better. It looks like the client is getting disconnected from the entire photon server. Master server, everything. I have to fully reconnect to the master server and then rejoin. I can guarantee this NEVER happens in a dev build or in the unity editor.