Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Third Party Photon the client keeps disconnecting in webgl

Discussion in 'Multiplayer' started by Teo935, May 13, 2024.

  1. Teo935

    Teo935

    Joined:
    Feb 10, 2019
    Posts:
    9
    hello have a multiplayer project that use photon pun 2 in webgl but the client keeps disconnecting when the browser tab is in backgroud , unity 2022.3.8f1 , someone have some advice ? thanks in advance
     
    Last edited: May 13, 2024
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,082
    This is normal behavior in some browsers. The update rate may be lower or entirely stopped.
    I didn't run into the issue in a recent Firefox with Unity's build and run option (so a local server).
    Try playback of some audio. Even if it's inaudible, some developers reported this works to get more updates.
     
  3. Teo935

    Teo935

    Joined:
    Feb 10, 2019
    Posts:
    9
    the best way to handle this would be to reconnect when you reopen the browser tab? or are there other ways?
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,082
    Yes, that's probably the best. When you create a room, you can set a PlayerTTL. During time, beginning with a disconnect, the player in question is marked as inactive for the others but still in the room. Players can ReconnectAndRejoin during this time. In best case, you clear the scene / networked objects before you reconnect, because they are being sent on join as if the returning player is a new one.
     
  5. Teo935

    Teo935

    Joined:
    Feb 10, 2019
    Posts:
    9
    Thanks for the answers , im gonna look in to that