public static void LoadHighScores(out TryScores tries, out TimeScores times) // Returns top 10 tries and times, seperate lists { string triesLeaderboard = File.ReadAllText(SCORE_PATH + "/tries.json"); string timesLeaderboard = File.ReadAllText(SCORE_PATH + "/times.json"); TryScores tryScores = JsonUtility.FromJson <TryScores>(triesLeaderboard); TimeScores timeScores = JsonUtility.FromJson <TimeScores>(timesLeaderboard); tries = tryScores; times = timeScores; }
// Set up file for leaderboard saves static void InitalizeLeaderboard() { TryScores tryBoard = new TryScores { _tryScore = new int[10], _timeScore = new float[10], _playerName = new string[10] }; TimeScores timeBoard = new TimeScores { _timeScore = new float[10], _tryScore = new int[10], _playerName = new string[10] }; string jsonTry = JsonUtility.ToJson(tryBoard); string jsonTime = JsonUtility.ToJson(timeBoard); File.WriteAllText(SCORE_PATH + "/tries.json", jsonTry); File.WriteAllText(SCORE_PATH + "/times.json", jsonTime); Debug.Log("Initalized Scores"); }