Load all players once room is full

Hello all,

So for my matchmaking, I've done when they click play, it loads a panel, and joins a room, the panel displays the current amount of players in the room, what I wanna do is when the room is full it loads the game. I'm simply using this, and calling it in Update

Code (CSharp):

  1.        if (PhotonNetwork.CurrentRoom.MaxPlayers == PhotonNetwork.CurrentRoom.PlayerCount)
  2.        {
  3.         PhotonNetwork.LoadLevel("Game");
  4.        }

But the problem is once the room is full, it only loads the screen for the last person who joined the room, not for the other players, why? I'm using this to instantiate them

Code (CSharp):

  1. PhotonNetwork.Instantiate("Shooter", new Vector3(0, 0, 0), Quaternion.identity);

This is called in a script in the game scene, called in the start function so when the scene loads for every player, it instantiates them. All help will be appreciated, thanks

Answers

  • so PhotonNetwork.LoadLevel should only be called if you're the Master Client, but most likely you'll want to use that in conjunction with PhotonNetwork.AutomaticallySyncScene = true. that said, idk why the last person joining is the only one that is loading the level.

  • Hey, thanks for your reply

    I already use PhotonNetwork.AutomaticallySyncScene = true in my connect function! Also I have added the IsMasterClient Check while loading the game scene and also an update. I tried it with 3 players, and the problem is only the MasterClient doesn't get instantiated, so the player who created the room. Why is this happening?

  • This is something we can't answer here, due to lack of the project / code.

    Please check if PhotonNetwork.Instantiate(character,...) is being called on the Master Client, as it is on the other clients. If it is, check when it's called. If the Master Client calls it before loading the next scene, then the Master Client's character is gone due to loading.

    You can Debug.Log() in a script that is on the character. Log the PhotonView of the GameObject in Start() and OnDestroy(), e.g.

  • I'm not sure what else I could provide to be honest, and if I call PhotonNetwork.Instantiate on MasterClient, no one gets instantiated. Im not sure what I'm doing wrong

  • UPDATE:

    Just found this, created room on the unity editor, and after the room is full, this is what is happening

    I'm confused though on how to fix it?