The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Handle Disconnect

Clevereen
2021-01-25 13:47:40

Hello,
i'm using PUN2 and I try to handle disconnection. My goal is to display the player who is having a disconnection issue and wait for him before he is kicked out.

I read the documentation but somehow, the callback method is never called.

Comments

JohnTube
2021-01-25 23:16:46

Hi @Clevereen,

Thank you for choosing Photon!

  • This discussion was first posted under Photon Voice category, I have moved it to PUN category as I don't see anything Photon Voice specific.
  • MonoBehaviourPunCallbacks class already extends IInRoomCallbacks so no need to implement it in PhotonRoom just override any callback method needed from there.
  • OnPhotonPlayerDisconnected is from PUN classic, in PUN 2 it was replaced with IInRoomCallbacks.OnPlayerLeftRoom. Read more about Callbacks Changes.
  • IInRoomCallbacks.OnPlayerLeftRoom is triggered only for remote players, for the local players you have IConnectionCallbacks.OnDisconnected (or IMatchmakingCallbacks.OnLeftRoom).

Clevereen
2021-01-26 09:47:50

Hi @JohnTube ,

thanks for the reply. I have used the code and so far, it is not really working as intended.

Here is the result with screenshot.
[

](https://ibb.co/6w3JDm9)

Problem : The connection issue is shown only when it's "too late"
It does display on both players that a connection issue has been detected, but unfortunately it is always too late.
I can't find a solution (both remote and local) to display the issue right away and then set a countdown before the timeOut is fired.

Clevereen
2021-01-27 16:58:36

Found the solution... I will share later

Back to top