public void SaveHighScore() { Difficulty savedDifficulty = (Difficulty)PlayerPrefs.GetInt("Difficulty"); TimerController timerController = FindObjectOfType <TimerController>(); string userName = userNameField.text; int score = HighScoreHelper.CalculateHighScore(Mathf.FloorToInt(timerController.GameTime), movesCount, savedDifficulty); HighScores hs = HighScoreHelper.LoadHighScores(savedDifficulty); ScoreEntry newHighScore = new ScoreEntry(userName, score); HighScoreHelper.AddHighScore(hs, newHighScore); HighScoreHelper.SaveHighScore(hs, savedDifficulty); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1); }