How to instatiate two players simultaneoulsy before loading level

Hi, I’m new in unity networking and I’m using photon server for multiplayer game, and I’ve two scenes.

In first scene, I want a new player who has joined the room, to wait for another player to join. After total player count equals two I’m loading a new scene, where I’m actually instantiating prefab. But only the last player who has joined the room, actually able to enter in new scene, other player stuck in first scene.

The code in first scene:

void OnJoinedRoom()
{
    if (PhotonNetwork.countOfPlayers == 2)
    {
    PhotonNetwork.LoadLevel(1);
    }
}

Code in second scene:

 void start()
    {
      PhotonNetwork.Instantiate("PlayerPad", Vector3.zero, Quaternion.identity, 0)
     
    }

Does anyone know how can I make possible to enter two more player simultaneouly in new scence, after meeting some condition first. Thanks in advance.

I even asked the same question Here, but couldn’t get any reply.

Your code look just about right: the player who joins the (Photon) room second will observe that countOfPlayers is 2.

When using PhotonNetwork.LoadLevel, you may need to also set PhotonNetwork.automaticallySyncScene to true.

Otherwise, the 2nd player’s call to lodd a level will not be synced to let the first player know that he should be loading a level.

See the API documentation here: http://doc-api.exitgames.com/en/realtime/current/pun/doc/class_photon_network.html#a5bb`203a37b6db717583ea7b81fb56852