Problem on PhotonNetwork.player.GetTeam() method.

Options
Hi,

I have a problem about GetTeam method. I'm working on a 1v1 multiplayer game, and my matchmaking system set the players' teams based on joining queue in room. But, once the game starts, sometimes the GetTeam method not get the correct value. Can you help me about that?

Assign teams;
public override void OnJoinedRoom() { if(PhotonNetwork.playerList.Length < 2) { print(PhotonNetwork.playerList.Length); PhotonNetwork.player.SetTeam(PunTeams.Team.red); // red } else { print(PhotonNetwork.playerList.Length); PhotonNetwork.player.SetTeam(PunTeams.Team.blue); // green } if (PhotonNetwork.playerList.Length == PhotonNetwork.room.maxPlayers) { photonView.RPC("LoadGame", PhotonTargets.All); } }

Comments

  • Tobias
    Options
    You write "sometimes" it does not get the right team. In which situations? When exactly, event-timing wise?