Basically im using the photon unity plug in and im trying to get it to get it to show the player names but it keeps showing them in one place, why?
heres my code:
public class PlayersInRoom : MonoBehaviour {
public ArrayList ListOFPlayers=new ArrayList();
public float Movedown;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
void OnGUI()
{
foreach(PhotonPlayer pl in PhotonNetwork.playerList )
{
foreach(string player in ListOFPlayers)
{
if (player!=pl.name)
{
ListOFPlayers.Add(pl.name);
}
}
if((ListOFPlayers.IndexOf(pl.name) % 1)>0)
{
Debug.Log((ListOFPlayers.IndexOf(pl.name)));
if(GUI.Button(new Rect(0,(ListOFPlayers.IndexOf(PhotonNetwork.player.name)*100)+100,100,100),pl.name))
{
}
}
else
{
Debug.Log((ListOFPlayers.IndexOf(pl.name)));
if(GUI.Button(new Rect(400,(ListOFPlayers.IndexOf(PhotonNetwork.player.name)*100)+100,100,100),pl.name))
{
}
}
}
}
}