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

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.

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.

How to call OnDisconnect?

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?


2019-02-08 16:20:31

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)

2019-02-08 16:39:21

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.

2019-02-08 16:43:43

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