Photon view not destroyed on disconnection

We had just upgraded to PHOTON 2.

For Android - My player is in a room with one more player. My player disconnect the device from network, it immediately(within milliseconds) fires OnDisconnected(DisconnectCause cause) and OnLeftRoom() events. But none of the photon views are destroyed. The DisconnectCause is None.
But if we leave room explicitly both the photon views are destroyed automatically as they should.

Unity Editor - In editor it works fine in both cases. Just that when we disconnect from the network it takes about 30 to 40 seconds to call OnDisconnected(DisconnectCause cause) and OnLeftRoom() events and the DisconnectCause is ClientTimeout. But it successfully destroys the Photon Views, whether we left the room or there was a network disconnection.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited May 2020
    Hi @mohit_mittal,

    Is this latest PUN 2? 2.18.1?
    What Unity version is this?
    How can we reproduce OnDisconnected(DisconnectCause.None) as it should not happen?
  • Hi @JohnTube

    PUN: 2.16 Photon lib: 4.1.2.19
    UNITY: 2018.4.7f1

    It works fine in editor.

    It happens on android.
    Steps:
    1. Get the user into a room and 'PhotonNetwork.Instantiate' his prefab(having a photon view on it).
    2. Turn off the device's Wi-fi.
    3. OnDisconnected and OnLeftRoom are called within milliseconds with cause as None.
    4. The prefab with photon view on it, still lives in the scene.

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @mohit_mittal,

    OK thank you, we will investigate now and let you know.
  • Hi @JohnTube,

    I used the provided demos in the package to reproduce this issue. Its occurring on PUN: 2.16 and working fine on 2.18.1
    So i guess we just have to update the photon. form 2.16 to 2.18.1 in our project.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @mohit_mittal,

    Sorry for the delay on this one and thanks for the update.
    I should have told you to update to latest in the first place and retry.
    Consider this in any future issue.

    Yes this is probably fixed in PUN 2.18 which contains Photon Realtime version 4.1.4.0 that has the following entry in changelog:
    Changed: The LoadBalancingClient.OnStatusChanged will handle StatusCode.SendError as disconnect due to Exception. Log level INFO should log the inner exception when sending.
    You can confirm by logging the DisconnectCause when turning WiFi/Data off while connected using UDP on Android.

    Thank you for your patience and understanding.