- Home /
Question by
XTreak2000 · Mar 26, 2019 at 06:45 PM ·
leaderboardscoreboardscores
I don't know how to make a scoreboard/leaderboard
I want to make a scoreboard, tried for weeks, still I don't know what is wrong :/. This is my code:
public Text LevelComplet;
public Text Deaths;
public Text Time;
int[] lastLevelComplet;
int[] lastDeaths;
float[] lastTime;
void Start()
{
lastLevelComplet[GameManager.playercont] = PlayerPrefs.GetInt("levelCounter");
lastDeaths[GameManager.playercont] = PlayerPrefs.GetInt("deaths");
lastTime[GameManager.playercont] = PlayerPrefs.GetFloat("time");
for (int i = 0; i <= 9; i++)
{
LevelComplet.text += lastLevelComplet[i].ToString() + "\n";
Deaths.text += lastDeaths[i].ToString() + "\n";
Time.text += lastTime[i].ToString("f0") + "\n";
}
}
"playercont" it's a variable that counts how many players have finished the game. The number 9 in the code, it is how many rows have the scoreboard
Comment