The following code retrieves the player's score from the Google Play Leaderboard. If the retrieved value is superior to the one already stored on the device, the score is saved.
public void Update() {
PlayGamesPlatform.Instance.LoadScores( "myLeaderboardID", LeaderboardStart.PlayerCentered, 100, LeaderboardCollection.Public, LeaderboardTimeSpan.AllTime, (data) => { if (data.Valid) if (data.Scores[0].value > PlayerPrefs.GetInt("highScore", highScore)) { PlayerPrefs.SetInt("highScore", data.Scores[0].value); PlayerPrefs.Save(); } });
}
Unfortunately, I'm getting 2 errors on this line PlayerPrefs.SetInt("highScore", data.Scores[0].value);
error CS1502: The best overloaded method match for `UnityEngine.PlayerPrefs.SetInt(string, int)' has some invalid arguments
error CS1503: Argument `#2' cannot convert `long' expression to type `int'
How can I fix this?