I have two Floats, yOffset and playerCount. I’m using PUN and trying to give a HUD for each player joined. But it seems to be putting all of the HUDs at exactly the same height… I thought if I had a while loop that checks if the current rooms player count is higher than the float I created and added to the float after running the DrawTexture it would put them at different heights, but I can’t seem to figure this out and would really appreciate some help.
public float yOffset = 0;
public float playerCount;
while (PhotonNetwork.room.playerCount > playerCount) {
foreach (PhotonPlayer player in PhotonNetwork.playerList) {
GUI.DrawTexture (new Rect (355, yOffset, 100, 50), HealthBar);
}
if(playerCount != PhotonNetwork.room.playerCount) {
yOffset += 45;
playerCount += 1;
}
}
…
for(int i = 0; i < PhotonNetwork.playerList.Length; i++){
foreach (PhotonPlayer player in PhotonNetwork.playerList) {
GUI.DrawTexture(new Rect (0, i*(60) + 10, 150, 50), HUDBox);
GUI.DrawTexture(new Rect (0, i*(60) + 40, 150, 10), HealthBar);
GUI.Label(new Rect (0, i*(65) + 10, 150, 50), player.name);
}
}