Getting error when attempting to save score?

ساخت وبلاگ

Vote count: 0

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?

asked 20 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 290 تاريخ : پنجشنبه 31 تير 1395 ساعت: 15:31