Losing Connection on ios

Hi everyone,

i recently added Gamecenter Support to my Unity Game and it all worked out fine except for one thing. It seems that the Gamecenterpopups (Leaderboards, Achievements, finding another player to fight) let Unity pause for the time where the popups show. This of course leads to a disconnect from the photon server. My question would be: Is it possible to tell photon that it now goes in some kind of hibernating state and to wake it up again after the popup is disposed or do i have to write some recconect code to achieve that.

Best regards



  • dreamora
    No thats not possible.
    If the connection times out thats just whats gonna happen.

    You would need to use a 3rd party game center implementation that does not pause unity there I fear and optimally send a feature request through the unity bug reporter to request a parameter on showing leaderboards to tell it to not pause the execution
  • Tobias
    You can try to start a thread that takes over calling SendOutgoingCommands, which is what keeps your connection alive. We do this in PUN for you, when you set isMessageQueueRunning to false. Don't forget to turn it on when you're back.

    If you can't run any thread (any code at all) while game center shows up, you will loose connection and have to re-connect.
    You will likely find games through game center, so maybe you are fine with re-connecting. You don't have to enter the lobby to join a room when you already decided on the room's name.
  • I already changed the service command to run in another thread but it won't be fired when the Gamecenterwindows are displayed, thanks for the answers, i will write an automatic reconnect for that.
  • dreamora
    When UnityPause is called on iOS and alike, the whole mono environment is paused (as the idea is to use up 0 cpu cycles and hand it over to the UIKit overlay). Its an unfavorable situation but one you can only avoid by offloading photon into the object c layer completely