- Home /
Unity Photon Team One and Team Two?
Ok I know their is the Teams script i the photon demo, however I have found no Tutorial or explanation on how to setup my own teams (Team A and Team B) to join a team Onjoinedroom. (so first player joins team one, second team 2, third tema 1. act until I have 2 teams of 3 players.) Looking for an explanation of how To make a Set and join team system
Hi,
I would recommend you using the given PunTeams script to handle the $$anonymous$$m management in your game. If the $$anonymous$$m names doesn't fit to your game, you can simply change or extend them in the given script. To join a $$anonymous$$m in OnJoinedRoom callback you can use PhotonNetwork.player.SetTeam(PunTeams.Team.red);
to join a certain $$anonymous$$m, red in this example.
If I understand you correctly you want to automatically assign a certain player to a certain $$anonymous$$m based on his connection: therefore you can either use PhotonNetwork.room.PlayerCount and do some modulo operation (example PlayerCount % 2 == 1 means the client has to join Team Red) or you can use OnPhotonPlayerConnected(PhotonPlayer newPlayer)
on the $$anonymous$$asterClient who will assign a $$anonymous$$m to the new client.
Your answer
![](https://koobas.hobune.stream/wayback/20220612133347im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity photon multiplayer teams 3 Answers
How do I let my teammember access my local project 1 Answer
Changing Server/Network type. 1 Answer
If a player triggers a new map loaded, does all players join this new level ? (Photon mutliplayer) 1 Answer
how to change the character in photon angry bots demo? 1 Answer