How to call OnDisconnect?
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?
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?
0
Best Answer
-
Hi @Avalin,
Thank you for choosing Photon!
Yes, you should find the changes from PUN1 to PUN2 in the "Migration Notes" page.MonoBehaviourPunCallbacks
implementsIConnectionCallbacks
already.
The callback for disconnection isOnDisconnected(DisconnectionCause)
which now replaces all 3 callbacks from PUN1: OnDisconnectedFromPhoton, OnConnectionFail OnFailedToConnectToPhoton.5
Answers
-
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)0
-
Hi @Avalin,
Thank you for choosing Photon!
Yes, you should find the changes from PUN1 to PUN2 in the "Migration Notes" page.MonoBehaviourPunCallbacks
implementsIConnectionCallbacks
already.
The callback for disconnection isOnDisconnected(DisconnectionCause)
which now replaces all 3 callbacks from PUN1: OnDisconnectedFromPhoton, OnConnectionFail OnFailedToConnectToPhoton.5 -
Ah I see. My mistake was assuming I would still need to have a callback and not just call them inside methods. Thank you.0