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.
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.
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.
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.
1 Person is following this question.