I’m making an online first person shooter, and I’ve gotten to the point where i need teams. What i want to do is add the first player who joins to the red team, the second to the blue team, then third goes onto red etc. etc. The problem is, i have no clue how to do this at all. Can anyone help me with this? I’m using photon by the way. Thanks in advance!
Hi,
you can use PunTeams therefore. Whenever a client joins the room, he can compare the size of both teams and join the one which has fewer members or a certain team if both teams have equal number of members. To do so you can use PunTeams.PlayersPerTeam[PunTeams.Team.red].Count
(respectively for the blue team). To make sure that PunTeams work properly, please attach the PunTeams script to one of the game object in the scene.
The local player can join a team (the red team in this example) by using PhotonNetwork.player.SetTeam(PunTeams.Team.red);
.