How to call OnDisconnect?
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).
How to call OnDisconnect?
Avalin
2019-02-08 15:25:12
Seemingly ALL methods related to this behavior is deprecated, docs doesn't cover this meaningfully (Says its derived from IPunCallbacks which doesn't exist, and I'm deriving from MonoBehaviourPunCallbacks which holds behavior to connect, so why not the onDisconnect?)
I've tried OnFailedToConnect, OnFailedToConnectToMasterServer, OnDisconnectedFromServer etc. all those that pun suggests, and the OnDisconnectedFromPhoton seemingly just doesn't exist. I have just downloaded the most recent version of pun?
Comments
I learned from "Migration notes" that was suggested to another one with unrelated problems, that the interface now is IConnectionCallbacks. Not that that helped me, I still dont see any of the relevant methods being able to call... (OnDisconnectedFromPhoton, OnConnectionFail OnFailedToConnectToPhoton() etc...) (Also why couldn't I edit above post, when I can edit this for seemingly 1 day, and above is only less than an hour ago)
Hi @Avalin,
Thank you for choosing Photon!
Yes, you should find the changes from PUN1 to PUN2 in the "Migration Notes" page.
MonoBehaviourPunCallbacks
implements IConnectionCallbacks
already.
The callback for disconnection is OnDisconnected(DisconnectionCause)
which now replaces all 3 callbacks from PUN1: OnDisconnectedFromPhoton, OnConnectionFail OnFailedToConnectToPhoton.
Ah I see. My mistake was assuming I would still need to have a callback and not just call them inside methods. Thank you.
Back to top