Open KhalidSaud opened 6 years ago
Same issue. You'd think they'd test these simple and main uses, but guess not. I'm beginning to think Google does not maintain these plugins as stated on their website.
I also have this Issue. I tried almost everything but can not get it to work.
i am using GamesPlayPlatform instance and it's working fine.
if (PlayGamesPlatform.Instance.localUser.authenticated) { PlayGamesPlatform.Instance.ShowLeaderboardUI(); } else { Debug.Log("Cannot show leaderboard: not authenticated"); }
hope it will help.
GhassanF, do you mind showing us your code for logging in and authenticating using PlayGamesPlatform? Also, are you able to report scores and achievements using PlayGamesPlatform?
I'm having the same issue. I can send scores to leaderboard and see it on Google Play Games app, but I can't open LeaderboardUI on the game. In logs, callbacks are empty.
I attached the following script on the main camera in the scene that contains the sign in, show achievements and show leaderboards button
using UnityEngine; using GooglePlayGames.BasicApi; using GooglePlayGames; using UnityEngine.EventSystems; using UnityEngine.UI;
namespace Assets.Scripts { public class GooglePlayGamesManager : MonoBehaviour { public Text SignInButtonText; public Text AuthStatus; public GameObject AchButton; public GameObject LdrButton;
private void Start()
{
// Create client configuration
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
// Enable debugging output (recommended)
PlayGamesPlatform.DebugLogEnabled = true;
// Initialize and activate the platform
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
// Try silent sign-in (second parameter is isSilent)
PlayGamesPlatform.Instance.Authenticate(SignInCallback, true);
}
public void Update()
{
AchButton.SetActive(Social.localUser.authenticated);
LdrButton.SetActive(Social.localUser.authenticated);
}
public void SignIn()
{
if (!PlayGamesPlatform.Instance.localUser.authenticated)
{
// Sign in with Play Game Services, showing the consent dialog
// by setting the second parameter to isSilent=false.
PlayGamesPlatform.Instance.Authenticate(SignInCallback, false);
}
else
{
PlayGamesPlatform.Instance.SignOut();
SignInButtonText.text = "Sign In";
AuthStatus.text = "";
}
}
public void SignInCallback(bool success)
{
if (success)
{
SignInButtonText.text = "Sign out";
AuthStatus.text = "Signed in as: " + Social.localUser.userName;
}
else
{
SignInButtonText.text = "Sign in";
AuthStatus.text = "Sign-in failed";
}
}
public void ShowAchievements()
{
if (PlayGamesPlatform.Instance.localUser.authenticated)
{
PlayGamesPlatform.Instance.ShowAchievementsUI();
}
else
{
Debug.Log("Cannot show Achievements, not logged in");
}
}
public void ShowLeaderboards()
{
if (PlayGamesPlatform.Instance.localUser.authenticated)
{
PlayGamesPlatform.Instance.ShowLeaderboardUI();
}
else
{
Debug.Log("Cannot show leaderboard: not authenticated");
}
}
}
}
Tried PlayGamesPlatform.Instance.ShowLeaderboardUI() and Social.ShowAchievementsUI() . They don't work.
same here. wtf...
Any updates on this?
My problem was solved. It seemed to be an issue with the postprocess step. The GooglePlayServices.plugin project is not exported to gradle at all, thus my game not having app_id or version strings in xml. I just renamed the folder then renamed it back and it worked. Really weird.
@zeyangl Could you please elaborate?
I am using the unity play game services plugin 0.9.36 for my game which was published last year and was working correctly. But last week I updated the game and deleted the old leaderboard and added a new one but it won't work. When I open the leader board for the first time with zero highscores it works, but when I make a new highscore , the leaderboard does not open. I am using the following code to display the Leaderboard - public void OnLeaderboardClick() { if (Social.localUser.authenticated) { Social.ShowLeaderboardUI(); } } I am using the following code to report scores to the Leaderboard - public void ReportScore(int score) { Social.ReportScore(score, "leaderboardId", (bool success) => { Debug.Log("Report score to leaderboard " + success.ToString()); }); }
Please help I am stuck on this for many days now!!!!!!!
This is year 2022... I'm done looping through all the possible issues to find a solution. I have the same problem, login is successful, I can post scores but can not show leaderboards from my game.
Any advice? Maybe during this 4 year period you find a solution?
Note: I also don't see a confirmation popup for sign-in.
Hello everyone,
I'm trying to figure out if I'm doing the coding wrong or not,
`using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using GooglePlayGames; using UnityEngine.SocialPlatforms; using GooglePlayGames.BasicApi;
public class GameManager : MonoBehaviour {
// Use this for initialization
void Start () {
} `