0
\$\begingroup\$

I'm trying to create a leaderboard for my game. I have the game created and added the leaderbaord using cloudonce. I have also created the app on google play console and linked the app to the game services. I have followed the following tutorial to create the leaderboard: Leaderboard tutorial

I have followed the exact same instruction as given in the tutorial. Once the game is over, the leaderboard button is activated. I have attached LeaderboardsButton script(this script comes with the CloudOnce package) to the leaderboard button. Here is the code in the game over panel for getting the score:

void OnEnable()
{
    DisplayGameOverScore();
}
void DisplayGameOverScore()
{        
    gameOverScore.text = ((int)gameManager.playerScore).ToString();       
    gameOverHighScore.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
    CloudOnceServices.instance.SubmitScoretoLeaderboard(PlayerPrefs.GetInt("HighScore", 0));
}

This is the CloudOnceServices script as per the tutorial:

public static CloudOnceServices instance;

private void Awake()
{
    TestSingleton();
}

private void TestSingleton()
{
    if (instance != null)
    {
        Destroy(gameObject);
        return;
    }
    instance = this;
    DontDestroyOnLoad(gameObject);
}

public void SubmitScoretoLeaderboard(int score)
{

    Leaderboards.HighScore.SubmitScore(score);
}

I have attahced this script to an empty game object along with the InitializeCloudOnce script(this is provided with the CloudOnce package).

I have also created an alpha test on googleplay. Once I open the link and start the game, the google play services console open and when I hit the leaderboard button, google play services console loads but after that nothing happens. It just goes back to the game. I read that other people ran into similar issues and the advise given was to check if the SHA1 certificate fingerprint is the same in app signing under release management and the credentials in GoogleApis. They both match. I'm not sure what the issue is?

\$\endgroup\$
1
  • \$\begingroup\$ This sounds like a question about CloudOnce or Android publishing, not a question about game development with Unity. Your best bet is to try CloudOnce support resources (e.g. forums if they have them). \$\endgroup\$ – Kevin Jul 15 '20 at 18:56
1
\$\begingroup\$

It's probably an authentication problem. In case you're allowing Google to sign your APKs it means only the builds downloaded from the Playstore will be authenticated. If you build any new APKs without uploading them to your developer account you have to add your local build's SHA1 cert to the API console and link it to your app on the Google developer console before it can authenticate users.

\$\endgroup\$
1
  • \$\begingroup\$ thanks... I will try to implement this... \$\endgroup\$ – single arrow games Jul 24 '20 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.