question

robert avatar image
robert asked

Error in Statistics, GetLeaderboard

We can query all relevant PlayerProfile data using the new PlayerProfileViewConstraints member. But as soon as we set "ShowStatistics" to true we get a Invalid view constraints error.

WORKS:

ProfileConstraints: (Optional)
{"ShowDisplayName":true, "ShowLinkedAccounts":true, "ShowLocations":true}

FAILS:

ProfileConstraints: (Optional)
{"ShowDisplayName":true, "ShowLinkedAccounts":true, "ShowLocations":true, "ShowStatistics":true}

{
 "code": 400,
 "status": "BadRequest",
 "error": "InvalidParams",
 "errorCode": 1000,
 "errorMessage": "Invalid view constraint.",
 "CallBackTimeMS": 391
}
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Okay, ShowStatistics is now available in the Server API calls to get leaderboards. Let us know if you run into any issues.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

robert avatar image robert commented ·

Thats awesome, will give it a try immediately!! (Any ETA when it will be available in the Client API too?)

0 Likes 0 ·
robert avatar image robert robert commented ·

Awesome, working perfectly now, finally we can show all stats in the leaderboard without having the query data for every user. Thanks!

0 Likes 0 ·
brendan avatar image
brendan answered

As with the other post on this topic, please update to the latest version of the Unity SDK, released today. We introduced the profile data as part of our GDC release, but had to update immediately with a formatting change which we've since updated the SDK to support. Sorry for any confusion this may have caused.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

robert avatar image
robert answered

The other issue was fixed with updating the SDK. Unforuntaltey this issue still remains and I doubt its an SDK issue because this happens from the cloud script too and even when using the "Try it" javascript for GetLeaderboards.

This is causing the issue:

var profileConstraints = {};
 
profileConstraints.ShowDisplayName = true;
profileConstraints.ShowLinkedAccounts = true;
profileConstraints.ShowLocations = true;
profileConstraints.ShowAvatarUrl = true;
profileConstraints.ShowStatistics = true;
  
var resultLeaderboard = server.GetLeaderboard({MaxResultsCount:100, StartPosition:0, StatisticName:"XP",  ProfileConstraints:profileConstraints});


If we omit the ShowStatistics true parameter the function executes correctly.

Any ideas?

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

As part of the change to the format, we actually disabled ShowStatistics, as we're updating the format for that part of the profile data. The fact that it's still showing up in the updated docs is an error, so again, my apologies for the confusion. I'm talking to the team now about the review process for doc updates, so that we can make sure this doesn't happen in future.

We'll update soon with the final version of the statistics as soon as we can.

0 Likes 0 ·
nbardin avatar image
nbardin answered

So, how do you get the Statistics then please? @Brendan

,

So, how can we get the statistics now please?

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nbardin avatar image nbardin commented ·

Sorry for the double message, i can't edit it :/

0 Likes 0 ·
brendan avatar image brendan nbardin commented ·

No worries - and just so you know, the AnswerHub folks are working on an update right now which will improve the editing experience pretty massively. :)

0 Likes 0 ·
brendan avatar image brendan commented ·

We'll be re-enabling ShowStatistics once we have the format update in place. Once that's available, you'll be able to get the additional stats for all users in the leaderboard listing.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.