disconnect the player

Options
Hi!

When the player minimize (hide) the application, his character stays active in the room. How can I disconnect the player and close the room if the player do not open the application after some time interval?

Comments

  • chvetsov
    Options
    Hi.
    if you use cloud, then you may do this only on client. I can not say exactly how to check that player minimized application, but all you need to disconnect player - just call peer's Disconnect method.

    you may use same way for self hosted photon. or you could check last player activity and disconnect after some timeout
  • http://docs.unity3d.com/ScriptReference ... Focus.html

    That's if the game has focus or not.

    if they don't have focus. On the client, start a timer. then disconnect / display warnings, etc.