question

Diaconescu Cosmin avatar image
Diaconescu Cosmin asked

Method GetUserDataRequest for 50 playfabID's not working -> Similar method??

Hello!

The steps of my game are the following:

1. Make an empty list of strings for playfabId's.

2. Call GetLeaderboardRequest with 50 players max result count.

3. Each result will add a playfabId in my list.

4. Call GetUserDataRequest for every playfabID and my list. This will return me a value of 1 or 0 that will be added into an empty list.

The problem is that getUserData is not working for every playfab that I have and it is working only once!!!

Maybe there are many requests done to the same server and PlayFab has a protection.

Can you help me sort this out with a more detailed explanation?

I need a method that can be applied for the first 50 members (like GetUserDataRequest for every playfabID in my list)

Thank you!

P.S Each value of 1 and 0 will help me activate a specific icon in the leaderboard!

dataCustom Game ServersPartner Add-onsPlayer Inventorygame manager
10 |1200

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

1 Answer

·
Seth Du avatar image
Seth Du answered

May I ask are you using Unity to implement this feature? Are those Client API or Server API calls?

In Unity Engine, if you want to get a batch player data from leaderboard, you may define coroutine with Waituntil to avoid conflict issues. A for loop will reach API burst limit quickly in less than 1 second, which will report errors. Please refer to my sample on sample.cs (github.com) to refine the code. Asynchronous tasks can be more complicated to implement in Unity than in C# SDK. If you are looking for a more efficient method, please find dedicated support from Unity Community. Meanwhile if it is Client API calls, please note that there is general upper bound rate limit of 100 calls/2 minutes, and if you intend to do it, please make sure the subsequent API calls won’t exceed this limit.

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.

Diaconescu Cosmin avatar image Diaconescu Cosmin commented ·

Hello!

Thank you for your answer! The solution was pretty simple, in case someone else is looking for it:

1. By default, permissions to server are set to private, so you have to manually set them to public, by using Permission = UserDataPermission.Public.

2. Next, after using GetLeaderboardRequest you can make an Array/List to add each PlayfabID as a string.

3. When the last user from GetLeaderboardRequest was received, you can Start a Coroutine to GetUserDataRequest using the playfabid stored earlier with a delay of minimum 0.4f.

Hope it helps someone else looking for the same problem!

0 Likes 0 ·
brendan avatar image brendan Diaconescu Cosmin commented ·

I feel that it's important to highlight that you're spinning the Profile Read meter for every one of those read calls. One optimization would be to only grab the user data for a few players, if you need to have extra info in the display that cannot simply be other statistics (since you can get other stats for each player from the leaderboard call), and then only query for user data from additional players based on the local user's selections.

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.