In my scoreboard UI I have a box that is just an image with Score_Entries inside as children. There are 4 children, one for each player in the game. When the scoreboard starts up I have a function that assigns the text inside the Score_Entries Ui elements. To do this I have an array called Text[] playerNames and my UI elements are dragged into this in the inspector.
int i = 0;
foreach (Player test in PhotonNetwork.PlayerList)
{
playerNames[i].text = test.NickName;
allscores[i].text = 0.ToString();
i++;
Debug.Log("Text inside the array: " + playerNames[i].text);
Debug.Log("Player Name: " + test.NickName);
}
As you can see I have set the text inside my first Text element to equal a name of a player. However, what should happen is in the Debug statements the Player Name line output and the Text inside the array output should Show me the string stored inside test.NickName
. say test is players name. playersNames[i].text should == test
currently it shows playerNames[i] = TEST NAME
which is my default text when creating the UI. However, in the game, the name of the player is shown correctly as test not TEST NAME.
I dont see how this is working can someone help?
the problem is i++ put i++ after
Debug.Log("Text inside the array: " + playerNames[i].text);
Debug.Log("Player Name: " + test.NickName);
i++