Search Unity

Show "START GAME" button after all players connected.

Discussion in 'Multiplayer' started by NeonRedux, Apr 26, 2021.

  1. NeonRedux

    NeonRedux

    Joined:
    Feb 18, 2018
    Posts:
    2
    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);
    }
     
  2. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    207
    Do you have that code in the OnJoinedRoom and OnPlayerJoinedRoom overrides?
     
    Munchy2007 likes this.