how to close all rooms at a certain time

I'd like to close all game rooms (even though there are players in) at a certain time. For example, every monday 4:00am.
It seems rooms have more garbages as time goes by. Because of program or network errors. So I thought I need to close all rooms to start it all over once in a while.
I'm afraid if this is bad idea.

How can I close all rooms at the same time? Any Photon commands for this?
Or can I do this in the Photon homepage, not in the source codes?
I'm using PUN and Unity3D. Thanks for any help.

Comments

  • Hi @mhhk88,

    How can I close all rooms at the same time? Any Photon commands for this?
    Or can I do this in the Photon homepage, not in the source codes?
    There is no way to do this out-of-the-box. Do this from client code to force leaving rooms, disconnects or updates (new build with a new GameVersion/AppVersion) via custom events or custom authentication.
  • mhhk88mhhk88
    edited August 2019
    I see. Thanks.
    Do these codes successfully close the room?

    ...
    if (PhotonNetwork.isMasterClient) {
        PhotonNetwork.room.visible = false;
        PhotonNetwork.room.open = false;
        PhotonView.RPC("ShowMsg", PhotonTargets.All, "Will close the room in a minute");
        yield return new WaitForSeconds(60f);
        PhotonView.RPC("ForceCloseRoom", PhotonTargets.All);
    }
    
    [PunRPC]
    void ForceCloseRoom()
    {
        PhotonNetwork.LeaveRoom();
    }
    
    [PunRPC]
    void ShowMsg()
    {
        //Show soon-to-be-disconnected message
    }
  • Hi @mhhk88,

    Yes.
  • Thank you !!!
  • thanks for the proposed theme
Sign In or Register to comment.