question

developerjazzhaq avatar image
developerjazzhaq asked

Get Player Data(title)​ values.

What is the best way and functions to get Player Data(title) values of friend or some other player whose Playfab id and username is known. A code snippet or tutorial is really healpful.

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

·
brendan avatar image
brendan answered

First, it's important to note that only User Data and User Read Only Data are available to the Client API. And what's more, if you it's data that another player should be able to read, it needs to have the Permission set to "Public" when it is written - and example SSL call is in the docs for that here:

https://api.playfab.com/documentation/client/method/UpdateUserData

Given that you already have the PlayFab ID of the other user, reading their data is trivial - simply add the PlayFabId parameter to the call, with it being set to that player's PlayFab ID (as a string of hex digits). If you have a look at the GetUserData function in the Unicorn Battle sample code, you'll see an example of this: https://github.com/PlayFab/UnicornBattle/blob/ff1285d8a13fb3e6f59f8df838a83a1a825258f2/UnicornBattle/Assets/Scripts/PF_StaticsAndHelpers/PF_PlayerData.cs

Just change the PlayerId in the request parameters to the PlayFab ID of the other user, in this case.

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.

developerjazzhaq avatar image developerjazzhaq commented ·

Ok, I already implemented it. But i was not knowing about the public permission. That was the reason i was not receiving any value from GetUserData function. Thanks for pointing that out.

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.