- Home /
Multiplayer ScoreBoard not Updating Correctly
I have a simple guy that should be displaying each characters score, however each player can only see their own score, and other players scores remain as 0's. Everything else displays fine. Movement is the scripts name where the points are stored. I advance points by doing points++; and getMaxPoints just returns a float with the players current points;
function OnGUI(){
if(PlayerOne!=null)
if (GUI.Button (new Rect (screenWidth-200, 0, 200, 50), PlayerOne.transform.GetChild(0).GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(TextMesh).text+": "+PlayerOne.transform.GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(Movement).getMaxPoints())) {
}
if(PlayerTwo!=null)
if (GUI.Button (new Rect (screenWidth-200, 50, 200, 50), PlayerTwo.transform.GetChild(0).GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(TextMesh).text+": "+PlayerTwo.transform.GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(Movement).getMaxPoints())) {
}
if(PlayerThree!=null)
if (GUI.Button (new Rect (screenWidth-200, 100, 200, 50), PlayerThree.transform.GetChild(0).GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(TextMesh).text+": "+PlayerThree.transform.GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(Movement).getMaxPoints())) {
}
if(PlayerFour!=null)
if (GUI.Button (new Rect (screenWidth-200, 150, 200, 50), PlayerFour.transform.GetChild(0).GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(TextMesh).text+": "+PlayerFour.transform.GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(Movement).getMaxPoints())) {
}
if(PlayerFive!=null)
if (GUI.Button (new Rect (screenWidth-200, 200, 200, 50), PlayerFive.transform.GetChild(0).GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(TextMesh).text+": "+PlayerFive.transform.GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent(Movement).getMaxPoints())) {
}
}
It isn't clear what is the issue, is get$$anonymous$$axPoints returning the wrong points for other players than the current? In this case you're probably doing something wrong when you increase points and they just don't increase.
No, lets say two players are playing. Player one see's his own points correctly but it displays player two's points as zero. Player two also see's his own points correctly but player one's say zero for player 2.
Your answer
Follow this Question
Related Questions
How to Use Leader Board Third Party API ? 2 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Score display error 1 Answer
View PvP scores on screen in real-time 1 Answer
Unity Game Score Script 1 Answer