So I have a leaderboard in my game. When a player has finished and their game is over, it should add their score to the leaderboard. If it’s a new highscore, their highscore will be changed and updated to the leaderboard and if it isn’t a new highscore, the players highscore will remain the same until it is beaten. For some reason when adding a player’s name and their highscore, it will only add the name and give the leaderboard entry a score of 0. I have debugged and everything comes up correct so I seem to be referencing everything correctly so I don’t know what I’m doing wrong. Here is the adding to leaderboard code below:
player.coins = player.coins + player.thisGameCoins;
if(scoreManager.newHighscore == true)
{
player.highscore = finalScore;
}
highscoresManager.AddNewHighscore(menu.userName, player.highscore);
gameManager.SavePlayerData();
The weird thing is, even if I replace the player.highscore with a hardcoded integer like this:
highscoresManager.AddNewHighscore(menu.userName, 10);
it will work perfectly and add the value of that integer to the leaderboard so I do not know what I am doing wrong, any help would be appreciated