Its a very weird have invested a lot of time in this. So asking here.
I am using this plugin and followed the steps https://github.com/playgameservices/play-games-plugin-for-unity
I just want to use Google play services in release mode for leaderboard only (i am using in alpha launch)
Here is my code for Auth in GPlay services :
void Awake(){
PlayerPrefs.SetInt("GameOverCount",0);
#if UNITY_ANDROID
Authenticate ();
#endif}
I have configured Gplay setup by providing 10+ digit Client ID
I have generated OAuth Client ID from Google APis using SHA1 of release.keystore that i am using. In Gplay service in DEveloper console : I have published the linked apps without any errors
public void Authenticate() {
if (Authenticated || mAuthenticating) {
Debug.LogWarning("Ignoring repeated call to Authenticate().");
return;
}
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.EnableSavedGames()
.Build();
PlayGamesPlatform.InitializeInstance(config);
// Activate the Play Games platform. This will make it the default
// implementation of Social.Active
PlayGamesPlatform.Activate();
// Set the default leaderboard for the leaderboards UI
((PlayGamesPlatform) Social.Active).SetDefaultLeaderboardForUI(leaderboardID_android);
// Sign in to Google Play Games
mAuthenticating = true;
Social.localUser.Authenticate((bool success) => {
mAuthenticating = false;
if (success) {
UnityAnalytics.CustomEvent("Auth Completed", new Dictionary<string, object>
{
{ "isAuthDone", true }
});
if(showScores){
Social.Active.ShowLeaderboardUI();
Debug.Log("should show leaderborad");
}
// if we signed in successfully, load data from cloud
Debug.Log("Login successful!");
} else {
// no need to show error message (error messages are shown automatically
// by plugin)
Debug.LogWarning("Failed to sign in with Google Play Games.");
UnityAnalytics.CustomEvent("Auth Failed", new Dictionary<string, object>
{
{ "isAuthDone", false }
});
}
});
}
#if UNITY_ANDROID
if (Authenticated) {
showScores = false;
((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(leaderboardID_android);
Social.ShowLeaderboardUI();
Debug.Log("should show leaderborad");
UnityAnalytics.CustomEvent("Authenticated and show android leaderboard", new Dictionary<string, object>
{
{ "isShowing", true }
});
}else{
showScores = true;
Authenticate();
}
#endif
Next, i release the alpha and check on android devices - i get a screen saying connecting to google play games...connects processes and then goes off the screen. It seems like it authenticates and goes off. But doesn't displays leaderboard for some reason. I am not able to understand why its happening and what's missing.
In my unity analytics, only once scores aren't loaded and i played it 20-30 times :
In my Developer console, Number of scores is empty :
Can anybody pls help in this, i can provide more details to people who can help / want to help....Thanks...
Choose Proguard for Minify > Release and Copy the content into Assets/Plugins/Android/proguard-user.txt
It's work for me.