Search Unity

Third Party I want to make matching system with photon.

Discussion in 'Multiplayer' started by wrjh29741489, Dec 14, 2019.

  1. wrjh29741489

    wrjh29741489

    Joined:
    Nov 10, 2019
    Posts:
    6
    I'm trying to implement a matchmaking system.
    If there are four players who have access to the room, I'd like to start the game and keep the loading window on.
    PhotonNetwork.CountOfPlayers
    I can get the number of players in the current room, but I don't know when to bring this.
    OnJoinedRoom(){
    }
    This function also runs only on the first-time MasterClient.
    What the hell should I do?
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,067
    The "Basics Tutorial" actually covers this case. Use the callback OnPlayerEnteredRoom.
    Whenever someone joins, this triggers.
    When you create a room, set MaxPlayers to 4 and close the room when the game starts (so nobody can join later).
    Also see the Matchmaking Guide.