i wrote a script where i can see the health of a player but when more than 2 players connect, you see the hp of your player and the hp of the other player
so what does i have to change to see the hp of only your player?
i hope i get soon as possible a answer.
thx
jenten
public void ScoreHealth()
{
GUILayout.BeginArea(new Rect(Screen.width /2 - 200, Screen.height / 2-250, 400, 500));
foreach(MyPlayer.player in MultiplayerManager.instance.PlayerList)
{
GUILayout.BeginHorizontal("box");
GUILayout.Label("HP");
GUILayout.BeginVertical(GUILayout.Width(150));
GUILayout.Box(player.PlayerHealth.ToString(), GUILayout.Width(150));
GUI.color = Color.red;
GUILayout.EndHorizontal();
}
GUILayout.EndArea();
}
}
Why not just check if the player you are looping through has a certain parameter that makes it local?
– Benproductions1i just want a new line from these: foreach(MPPlayer player in MultiplayerManager.instance.PlayerList)
– jenten_lefeverIf your local player is in that list, unless you use something like a hashtable, you can't avoid looping through it
– Benproductions1