Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Anyone else hit the non-integer value leaderboard update issue? :)

A topic by Fodi created Sep 13, 2021 Views: 268 Replies: 5
Viewing posts 1 to 3
Submitted (1 edit) (+1)

Hi folks!

Not sure if anyone else encountered the aforementioned problem, but in any case and for future reference (hopefully not for long), keep a lookout if you're trying to push a non-integer Value to the /Client/UpdatePlayerStatistics PlayFab endpoint - it seems that the API will reject it with a not-so-helpful error message along the lines of:

Error:Invalid input parameters
Statistics[0].StatisticName: The StatisticName field is required.

Since my crappy last minute game-prototype-thingy was intended to be speedrun, I was trying to submit fractional numbers (seconds) and had no idea this was an issue, because the docs said the allowed type is "number", not "integer". I've found the clue and solution in the PlayFab community forums - after the deadline of course ;) Just my luck, I should've googled earlier.

I've already fixed the bug, wrote a bit about it in the devlog and will update the game if I can; I hope the info will be useful for others as well.

HostSubmitted(+1)

Do you have this turned on in the PlayFab dashboard?

I've gotten an unexpected error for not having it on a few times. I can't remember if that was it or if it was something else.
 

Submitted (1 edit) (+1)

Yes, thanks to Shawn's super useful quick start guide, that was the first thing I did :)

I'm quite sure it's the integer vs fractional number thing, I can reproduce it any time I try to submit a non-integer number and the call works perfectly if it's an integer. I've done a very easy fix: I round values to two decimals then multiply by 100 and parse the result as an integer to be 1000% safe :)

Submitted

Hey Fodi, it looks like you found the solution haha. I had the exact same issue trying to store decimals in the Leaderboard and it was only until i came across a different Playfab forum article with the same answer that i solved the problem. Glad you caught the problem in time, and yeah this would classify as a Bug and not a Feature so feel free to update your game with the fix :)

Submitted(+1)

Thanks Shawn! I've fixed the bug and updated the game yesterday :)

HostSubmitted(+1)

Excellent! And glad you found a workaround! :)