- Home /
Question by
reddmarty · Mar 24, 2020 at 05:26 AM ·
unity 5uinetworkingarray
UNITY NETWORK SCOREBOARD
Hello Guys, Im currently creating scoreboard for my multiplayer but first i need to list all player on array How can I insert each player in array in each devices it only shows one player ex.
player1 is in pc[0] player2 is in pc[1]
NetworkManager networkManager = NetworkManager.singleton;
pc = networkManager.client.connection.playerControllers;
for (i = 0; i < pc.Count; i++)
{
if (pc[i].IsValid)
showname.GetComponent<Text>().text = pc[0].gameObject.name;
showscore.GetComponent<Text>().text = pc[0].gameObject.GetComponent<multscore>().score.ToString();
showname2.GetComponent<Text>().text = pc[1].gameObject.name;
showscore2.GetComponent<Text>().text = pc[1].gameObject.GetComponent<multscore>().score.ToString();
Comment
Your answer
Follow this Question
Related Questions
IndexOurOfRange: Array index out of range. 0 Answers
When using unet to spawn players, the player object is invisible, but colliders present. Help 0 Answers
Having a hard time getting my GUI button which is generated at runtime to work. 0 Answers
Text UI broken after changing alpha color of single letters 1 Answer