hi This is my first attempt to implement leaderboard.
I also implement admob and firebase messaging services in my project.
In unity 2017.4 version there is error of dexmearging exception, and it continue appearing so i change to unity version 2019.1 where my problem is solved and successfully build the apk and aab.
Now the problem is that leaderboard score is successfully report to play sevices but when i open leaderboard it not there. score is not visible at all.
here is my code of leaderboard …
- autenticate user
private void AuthenticateUser () {
//ShowToast ("authenticate");
/*/
if (!PlayGamesPlatform.Instance.IsAuthenticated ()) {
PlayGamesPlatform.Instance.Authenticate ((bool success) => {
if (success) {
//ShowToast ("success");
ShowToast (Social.localUser.userName.ToString ());
} else {
ShowToast ("fail");
}
}, true);
} else {
PlayGamesPlatform.Instance.SignOut ();
ShowToast ("not possible sign in");
}
//*/
//
if (!Social.localUser.authenticated) {
Social.localUser.Authenticate ((bool success) => {
if (success) {
//ShowToast (Social.localUser.userName.ToString ());
ShowToast (((PlayGamesLocalUser) Social.localUser).Email);
isLoggedIn = true;
} else {
ShowToast ("Failed to login");
isLoggedIn = false;
}
});
} else {
PlayGamesPlatform.Instance.SignOut ();
ShowToast ("Not Logged In to leaderboard");
}
//*/
}
- Post score to leaderboard
private void postScoreToLeaderboard (long newScore) {
if (PlayGamesPlatform.Instance.IsAuthenticated () && ((PlayGamesLocalUser) Social.localUser).Email != null) {
Social.ReportScore (newScore, "CgkItpXu0pIJEAIQAQ", success => {
if (success)
ShowToast ("Score upload to leaderboard");
});
} else {
isLoggedIn = false;
AuthenticateUser ();
}
}
- Show leaderboard
public void showLeaderboard () {
if (PlayGamesPlatform.Instance.IsAuthenticated ()) {
//PlayGamesPlatform.Instance.ShowLeaderboardUI (GPGSIds.leaderboard_high_score);
//Social.ShowLeaderboardUI ();
((PlayGamesPlatform) Social.Active).ShowLeaderboardUI ("CgkItpXu0pIJEAIQAQ");
} else {
ShowToast ("Cannot show leaderboard : not login");
AuthenticateUser ();
}
}
the game is live now if possible please tell me the solution as soon as possible
here’s the game link
https://play.google.com/store/apps/details?id=com.whitespaceapps.findtheworldcup
Thanks in advance.