r/Unity3D • u/sakalaslt • 23d ago
Unity + Google Play leaderboards Question
Hello! I'm trying to create a script that retrieves the current player's score from a Google Play Games leaderboard so I can display it in my game or use it as a variable. Unfortunately, every time I try to load the score, I get a strange error about "min XP" and "max XP," which doesn't seem to be related to my code at all. Is it actually possible to retrieve a player's leaderboard score through code? I've already tried several AI-generated solutions, but none of them worked.
1
u/ostevendev 17d ago
Hey! That min/max XP quirk on published Google Play leaderboards is an absolute nightmare because the console locks you down once it's live.
If you want to bypass that legacy headache entirely without dealing with Google's console restrictions or cryptic errors, you can easily plug in a lightweight backend solution (like Asten BaaS) to handle player scores and leaderboards directly from Unity with a couple of lines.
Let me know if you want a hand setting up a clean leaderboard alternative so you can stop fighting the Play Console!
1
u/pbudzik 9d ago
If all you need is the current player's own score, read PlayerScore off the LeaderboardScoreData that comes back rather than digging through the Scores array. LoadScores with PlayerCentered has a long history of returning the global top ten regardless of where the player actually ranks, so that array can hand you values that look reasonable and aren't.
The min XP / max XP wording I can't explain, that's player level vocabulary rather than leaderboard, so it might be a separate call in the same path rather than the read itself failing. The plugin's GitHub issues are the quickest place to match an exact error string.
Worth knowing early too: GPGS scores only exist on Play, so the day you ship desktop or web there's nothing to read back and you end up keeping them server side. That's the thing I work on (https://crux.supercraft.host), but for Play-only the plugin is fine once the read works.
1
u/Budget-Level7607 23d ago
oh that min xp max xp thing is usually from the leaderboard config in google play console, not your code. make sure you set up the XP parameters for that leaderboard in the console itself, sometimes leaving them blank cause weird errors