Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Count of rooms is zero after room creation

Discussion in 'Multiplayer' started by WeeborWeed, Nov 17, 2022.

  1. WeeborWeed

    WeeborWeed

    Joined:
    Aug 31, 2020
    Posts:
    6
    I am using Photon2 on my project right now. And the join room function was actually fine a month ago, but when I am reviewing it today, I am having trouble to join a created room from other clients, citing that game does not exist. So I did some back tracking and found out that when the room is being created in the first place, it is not being recognized by PhotonNetwork.CountOfRooms.

    And what is even wierder, after I createRoom, I did the following print statement:


    And the result is:


    How could this be possible? On the one hand, PhotonNetwork does not recognize this room as one of the rooms available, but on the other hand, the PhotonNetwork.CurrentRoom clearly shows that this room not only exists, but is also open and visible to other players.

    Btw, I've also checked that the room is not in offline mode.

    Does anyone know what is going on here? And how can I actually make this room available for other players to join?
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,957
    When creating a room or joining one, the client leaves the Master Server to connect to the assigned Game Server. Functionality provided by the Master Server is no longer available, which means CountOfRooms is unknown while in a room.
    There is a workaround for this by connecting another client to the Master Server but as this drives traffic and costs for a minor gain, it's not very popular.

    Aside from leaving one server for another, creating and joining rooms will take a moment! The count does not go up until someone is actually using the room on the Game Server.

    Anyone connected to the Master Server should sooner or later get an update for CountOfRooms. This is not immediate, as a popular game will make the room counts fluctuate a lot, so it's only updated every few seconds.

    Other clients can only see rooms which are using the same Region and Game Version string. See the link for some more details (which I think don't apply here).