public void AddEntry(string name, double score) { if (LastAddedEntry != null) { // Remove last added entry from LeaderboardData, if there are duplicates just remove one LeaderboardData.Remove( LeaderboardData.Find(entry => entry.Name == LastAddedEntry.Name && entry.Score == LastAddedEntry.Score)); } // Make sure we round the score so that a floating point score doesn't overlap the name LastAddedEntry = new LeaderboardEntry(name, Math.Round(score).ToString(CultureInfo.InvariantCulture)); LeaderboardData.Add(LastAddedEntry); LeaderboardData.Sort(); File.WriteAllText(LeaderboardPath, JsonConvert.SerializeObject(LeaderboardData)); LoadLeaderboard(); // Reload the leaderboard }