I have a problem with google achievements and leader board .I have them working but in the leader board the score changes when you exit the game and play again, also the achievements do the same.Here is the code.
public class achActive : MonoBehaviour {
private int score;
private int gamesplayed;
void Awake()
{
gamesplayed = PlayerPrefs.GetInt("gamesplayed");
score = PlayerPrefs.GetInt("BestScore");
}
void Start()
{
// achievement
if (score >= 50)
{
Social.ReportProgress("Id", 100.0f, (bool success) =>
{
});
}
// achievement
if (score >= 100)
{
Social.ReportProgress("Id", 100.0f, (bool success) =>
{
});
}
// achievement
if (score >= 300)
{
Social.ReportProgress("Id", 100.0f, (bool success) =>
{
});
}
// achievement
if (score >= 500)
{
Social.ReportProgress("Id", 100.0f, (bool success) =>
{
});
}
// achievement
if (gamesplayed >= 1000)
{
Social.ReportProgress("Id", 100.0f, (bool success) =>
{
});
}
// leaderboard
Social.ReportScore(score, "Id", (bool success) => {
// handle success or failure
});
}
}