I have two Scenes, Menu and TestMap. On Menu you’re able to create a server and join one, the first issue I’m having is with listing players. I’ve tried various things but the only way I can get Unity to add the PhotonNetwork.playerName to a Text object and add a new line without it constantly looping is either through a one off IEnumerator or by adding a bool which once disabled stops the loop. Only issue is this also makes it a run once thing. So instead I used the first and set it inside the OnPhotonPlayerConnected.
IEnumerator UpdatePlayerList(PhotonPlayer o, string func) {
yield return new WaitForSeconds (0.1f);
if (func == "Add") {
if (o.GetTeam ().ToString () == "blue")
BlueTeam.GetComponent<Text> ().text += o.name + "\n";
if (o.GetTeam ().ToString () == "red")
RedTeam.GetComponent<Text> ().text += o.name + "\n";
}
if (func == "Remove") {
}
Debug.Log (o.name);
Debug.Log(o.GetTeam().ToString());
}
The next issue I’m having is I have a Canvas for the lobby, when players are meant to be in the Lobby this canvas is activated but I’m trying to get the game to allow the Master Client to start the initial game but there after any new connecting players I’d like to be able to either load the TestMap scene on their own or be loaded in straight away. I’ve set a button to use PhotonNetwork.LoadLevel which works but I’m seeing the other players in the Menu scene.