I have tried to change code around every which way I can find and i’m failing to get ShowLeaderboardUI to do anything, it won’t trigger an error even though it reports that the user is authenticated.
Same goes for ReportScore, the user is authenticated but the call fails.
I’ve tried using the leaderboard name and id, but publishing the score still fails.
In the Google Play Console, my leaderboards are published and my account is listed under test user.
The app is posted internal and the testing release track is set to internal with my account as a tester.
When the game launches, I see the google play services profile banner.
Here are the debug logs being reported with no errors.
Warn IntegrationHelper --------------- Google Play Services --------------
Info IntegrationHelper Google Play Services - VERIFIED
Info Unity Play Services: Initializing
Info Unity Play Services: AuthenticateUser called
Info Unity Play Services: Trying to authenticate user
Info Unity Play Services: User authenticated = True, message =
Info Unity Play Services: ShowLeaderboard called
Info Unity Play Services: User authenticated, showing leaderboard
Info Unity Play Services: ReportScore called
Info Unity Play Services: User authenticated, reporting score
Info Unity Play Services: Score reported = False
Here is the code being used.
public class GooglePlayService : IGameCenter
{
public void Initialize()
{
Debug.Log("Play Services: Initializing");
AuthenticateUser();
}
private void AuthenticateUser()
{
Debug.Log("Play Services: AuthenticateUser called");
if (Social.localUser.authenticated)
{
Debug.Log("Play Services: User authenticated");
}
else
{
Debug.Log("Play Services: Trying to authenticate user");
Social.localUser.Authenticate((isSuccess, message) =>
{
Debug.Log($"Play Services: User authenticated = {isSuccess}, message = {message}");
});
}
}
public void ReportScore(int score, string leaderboardId)
{
Debug.Log("Play Services: ReportScore called");
if (Social.localUser.authenticated)
{
Debug.Log("Play Services: User authenticated, reporting score");
Social.ReportScore(score, leaderboardId, isReported =>
{
Debug.Log($"Play Services: Score reported = {isReported}");
});
}
else
{
Debug.Log("Play Services: Trying to authenticate user");
Social.localUser.Authenticate((isSuccess, message) =>
{
Debug.Log($"Play Services: User authenticated = {isSuccess}, message = {message}");
if (isSuccess)
{
Social.ReportScore(score, leaderboardId, isReported =>
{
Debug.Log($"Play Services: Score reported = {isReported}");
});
}
else
{
Debug.Log("Play Services: Failed to report score");
}
});
}
}
public void ShowLeaderboard()
{
Debug.Log("Play Services: ShowLeaderboard called");
if (Social.localUser.authenticated)
{
Debug.Log("Play Services: User authenticated, showing leaderboard");
Social.ShowLeaderboardUI();
}
else
{
Debug.Log("Play Services: Trying to authenticate user");
Social.localUser.Authenticate((isSuccess, message) =>
{
Debug.Log($"Play Services: User authenticated = {isSuccess}, message = {message}");
if (isSuccess)
{
Debug.Log($"Play Services: Trying to show leaderboard");
Social.ShowLeaderboardUI();
}
else
{
Debug.Log("Play Services: Failed to show leaderboard");
}
});
}
}
}