1

So I have been trying to submit scores to my leaderboard with a Unity game for Android. I have been using the following plugin https://github.com/playgameservices/play-games-plugin-for-unity
Now do I have the followin code:

Social.ReportScore(Global.score, "LeaderbordID", success => { Debug.Log(success ? "Reported score successfully" : "Failed to report score"); });

That is supposed to work, but it doesn't. The error messages the code gives are non-existing, I get a false message. Logging in works fine, so he is connected. Any ideas where I can look for? My leaderboard ID is correct, I'm using that to show the leaderboards when asked.

Steven
  • 166,672
  • 24
  • 332
  • 435
Dytanoth
  • 107
  • 3
  • 11
  • Does showing the leaderboards work, or are you seeing the same issue as here? http://stackoverflow.com/questions/22058020/issues-implementing-achievements-and-leader-boards-unity-android-google-play/ – Peter Andrews Mar 04 '14 at 08:21
  • I m also facing this problem. have you got solution of this problem.If you got then give me solution please.Thank you. – Sudhir Kotila Aug 26 '14 at 14:49
  • Hello man, have you found an answer to the question? I have been trying for almost a week now and I still don't have know why this happens. – Lynx Nov 29 '14 at 14:19

1 Answers1

0

I FINALLY found a fix to this issue after a few days of testing!

When you call the Social.ReportScore() function it needs to be inside of the Social.localUser.Authenticate() function. Here's how I did it:

public void ReportHighScore(int newHighScore) {
    Social.localUser.Authenticate((bool success) => {
        if (success) {
            Social.ReportScore(newHighScore,
                "CXCXCXCXCXCXCXCXC",
                (bool success2) => {
                    //Handle Report Success
                });
            });
        }
    }
}

Instead of:

public void ReportHighScore(int newHighScore) {
    Social.ReportScore(newHighScore,
        "CXCXCXCXCXCXCXCXC",
        (bool success2) => {
            //Handle Report Success, but don't use this code
        });
    });
}

This feels like a hotfix for me to authenticate every single time, but I have found nothing else that works. I have seen another post on this Here where my answer was accidentally used but the answer was so vague I couldn't understand until I found it on my own. Sorry if my syntax is a little weird.

Austin
  • 1
  • 1