question

loopigames avatar image
loopigames asked

Use AvatarUrl and do not get avatar url

I'm trying to get AvatarUrl from the player but I do not get the url in unity. What can be happening?

unity3d
urlavatar.jpg (24.3 KiB)
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

Can you provide more details on your use case? What specific API call are you making, where you are expecting to get the AvatarUrl? What is the Title ID in question and what PlayFab ID are you using for the test?

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.

loopigames avatar image loopigames commented ·

Sorry, I do not know how to work with playfab, and I'm not speak in English, So I made a video showing the problem:

https://youtu.be/64HhWBjwfZ8

0 Likes 0 ·
brendan avatar image brendan loopigames commented ·

The items in the profile only show up if you specifically request them. So, with these parameters as input to Server/GetLeaderboard in your title:

{
                    
"StatisticName": "Score",
"MaxResultsCount": 20,
"ProfileConstraints": {"ShowAvatarUrl": true} }

I get this result, which includes the AvatarUrl:

{
    "code": 200,
    "status": "OK",
    "data": {
        "Leaderboard": [
            {
                "PlayFabId": "4B5B59CD339F766C",
                "StatValue": 4,
                "Position": 0,
                "Profile": {
                    "PublisherId": "308E2380E164C216",
                    "TitleId": "51D1",
                    "PlayerId": "4B5B59CD339F766C",
                    "AvatarUrl": "https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50"
                }
            }
        ],
        "Version": 2
    }
}

0 Likes 0 ·
loopigames avatar image loopigames commented ·
I solved my problem by looking here:

https://community.playfab.com/questions/10446/values-showavatarurl-missing-in-the-web-model-play.html

My code in C# with the fix:

thank you Brendan.



0 Likes 0 ·
playfabsolucao.jpg (123.3 KiB)
Karan Sahu avatar image
Karan Sahu answered
    private void GettingProfileInfo()
    {
        //Getting Playfab ID 

        PlayFabClientAPI.GetAccountInfo(new GetAccountInfoRequest(),
            result =>
            {
                _userId = result.AccountInfo.PlayFabId.ToString();
                Debug.Log("Your Profile Playfab Id Got : " + result.AccountInfo.PlayFabId);
            }, error => Debug.Log("Failed To Get Playfab Id"));


        //Getting DisplayName and Avatar Link

        PlayFabClientAPI.GetPlayerProfile(new GetPlayerProfileRequest()
        {
            PlayFabId = _userId,
            ProfileConstraints = new PlayerProfileViewConstraints()
            {
                ShowDisplayName = true,
                ShowAvatarUrl = true
            }
        }, result =>
        {
            _playerName = result.PlayerProfile.DisplayName;
            _avtarUrl = result.PlayerProfile.AvatarUrl.ToString();
            Debug.Log("DisplayName is : " + result.PlayerProfile.DisplayName + "\n" +
                "Avatar Url is : " + result.PlayerProfile.AvatarUrl);
            gettingPlayerStatistics();
        }, 
        error => Debug.Log("Failed To Get Playfab Id"));
    }
10 |1200

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

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.