- Home /
Question by
XTreak2000 · Mar 26, 2019 at 02:44 PM ·
score systemleaderboardscoreboardscoringscores
How to make a scoreboard?
I tried weeks to make this scoreboard work, still nothing. 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. number 9 it's how many rows can text have. (sorry for bad english tho)
Comment
Your answer
Follow this Question
Related Questions
How to save score for survival time? 1 Answer
Scoring System 3 Answers