Handle Disconnect
The whole answer can be found below.
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).
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
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).
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.
Found the solution... I will share later
Back to top