Host quit bug

Not sure if you guys have a formal way to submit bugs but I figured I'd put it here at least.

When the host quits a game an exception stating that PhotonTransportLayer has not started is thrown on the clients instead of them disconnecting/timing out cleanly.


  • We are working on this issue, next release will be solved.
  • We are getting that same exception when loading a scene (to move from lobby to gameplay) after joining a match. It's a major blocker for us (basically, cannot play the game online at all) and we would like to know if there is any workaround. Using Unity 5.5 BTW.
  • In 1.0.7 the client doesn't even receive a disconnection notice when the host quits. Previously, even with the timeout error it was handled - it's transparent now. How can I handle the host quitting on the client side?
  • After a lot of head bashing and lots of sniffing around using a .NET decompiler on the Thunder and Photon dlls, we finally managed to find the cause of the problem. We found out about the PhotonClient and how to get a reference to it, figured out the OnStateChangedAction delegate, so we could actually be notified when disconnected from the match and about the PhotonClient.DisconnectedCause property, which tells us why we got disconnected: timeout from the server.

    Using the .NET decompiler, we found out that the keep alive thread was only started when the ClientScene was initialized. However, the game we are working on doesn't use the ClientScene/ServerScene feature, scene changes are done directly by each peer, so the keep alive thread wasn't ever started and the client would time out while Unity was blocked loading a scene. Fortunately, PhotonMatchMaker.startKeepAlive() is public, so all we had to do was call it once during our matchmaker startup procedure and the bug went away.

    This particular implementation detail isn't documented anywhere, the startKeepAlive() method isn't even listed in the PUN docs. Took us over two days to find out the solution through reverse engineering.
  • ramonmelo

    You are right, this method was not documented yet, because it is used only internally when scenes changes. This method just send pings to Photon Server to keep the client connected receiving ACKs.