Hi , i have problem with setting teams in photon. i want to set half of my players in room to be in the Blue PUN team. it’s realy simple code but acting Wierd , the code have to apply for amount of " count " but doing more and make all of my players in room turn to blue.
here is my code :
using UnityEngine;
using System.Collections;
public class AutoBalancer : MonoBehaviour {
int count;
void Start ()
{
count = (PhotonNetwork.room.PlayerCount / 2) + 1;
foreach (PhotonPlayer player in PhotonNetwork.playerList)
{
count -= 1;
if (count > 0)
{
player.SetTeam(PunTeams.Team.blue);
}
}
}
}