Hi everyone, I have successfully integrated the Google Play Games plugin, however, the leaderboard is not showing when it’s called. I tried deploying and testing many builds ( 10+ and counting), but it can’t seem to work.
Calling to show Leaderboard:
using UnityEngine;
using System.Collections;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
using GooglePlayGames.BasicApi;
public class ShowLeaderboard : MonoBehaviour {
public void ShowLB()
{
Social.ShowLeaderboardUI ();
}
}
Calling to Authenticate User:
using UnityEngine;
using System.Collections;
using UnityEngine.SocialPlatforms;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
public class AuthenticateUser : MonoBehaviour {
void Start()
{
// recommended for debugging:
PlayGamesPlatform.DebugLogEnabled = true;
// Activate the Google Play Games platform
PlayGamesPlatform.Activate();
Social.localUser.Authenticate((bool success) => {
if(success){
Debug.Log("Logged in");
} else {
Debug.Log("Not Logged in");
}
});
}
}
Had a billion problems with this a few days ago but fixed now for me, I’m gonna guess that you don’t have a key in your keystore that isn’t the standard debug key. If not it may be because you need to set up the google developer console - https://console.developers.google.com/project and make sure that the credentials includes an AOuth 2.0 Client id which has the details of your android project.
In order to fix this problem I did tonnes of things I’m not really sure what solved this for me but hopefully one of those 2 fixes it for you.
Thanks for the help @2dSparrow , however, I don’t think that’s the case. I did follow a lot of tutorials and many of them never point out the steps you mentioned. Problem is my player is authenticated when the game starts, but when he is transferred to the main menu, there is no pop-up that welcomes the player, nor there is a leaderboard being showed when called using the UI button. And also i thought the UI button was not functioning properly, but it shows Debug logs fine and very responsive. So i don’t know exactly what is going on! do you think it could be the AndroidManifest.xml? I’m starting to guess that this is the main culprit.
The only thing I can suggest is to export your project as a google android project, build it in android studio and test it on your phone. Logcat will output the error (if any) from the google play client.
@2dSparrow Now it’s telling me i can’t export as an android studio project because there isn’t a “/libs” folder in my destination. Can i use the .apk file and open it with a third party app to debug my game? I’m running out of options and i’m considering to actually publish the game without any google play services.
The error: “DirectoryNotFoundException: Could not find a part of the path…/libs”
I had this issue as well where I couldn’t show the leaderboard or the achievements. I solved it by making sure that my email was one of the tester (since I used another one on the developer console). Hope this helps.