Show "START GAME" button after all players connected.

Options
Hello everyone, I'm very noob at programming and really new to Photon. I'm making a 2 players coop game with multiple lobbies and my problem at the moment is that I don't know how to make the "START GAME" button to be visible only when the lobby got 2 players. This is what I came up with which is not working. Thank you!

if (PhotonNetwork.CurrentRoom.PlayerCount == 2)
{
startGameButton.SetActive(true);
}
else
{
startGameButton.SetActive(false);
}

Comments

  • Ravindra5337
    Options
    You can override OnPlayerEnteredRoom(Player newPlayer) method and inside that method check for total number of players in room to enable startGameButton