question

Reason Random avatar image
Reason Random asked

How to display friend list in panel??

i add a friend successfully when i enter a friendemailid and then press request button and friend add a successfully but i want to display on them. See image

image

    Transform friendscrollview;              //scrollview
    public GameObject listingPrefab;        //btn
    public Transform listingContainer;      //position


    //Display Friend
    void DisplayFriends(List<FriendInfo> friendsCache)
    {
        foreach (FriendInfo f in friendsCache)
        {
            GameObject listfriend = Instantiate(listingPrefab, friendscrollview);
            ListingPrefab templisting = listfriend.GetComponent<ListingPrefab>();


           // PlayerPrefs.SetString("PlayerName", ListingPrefab.Instance.playerNameText.text);  //try setstring


            Debug.Log("playername:" + templisting.playerNameText);
            //Debug.Log("helloone"+ f.TitleDisplayName);
            templisting.playerNameText.text = f.TitleDisplayName;                               // TitleDisplayName PlayFab unique username for this friend.
        }
    }

display.png

Player Data
captures.png (13.9 KiB)
display.png (10.9 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.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

You can use PlayFab client API GetFriendList to get the friend list. Please click the link to check the API reference of it. About how to display a friend list on Unity UI Panels. You can check this sample PlayFabLeaderboardsUnity. It provides some functions on how to implement a UI list based on a requested data list. You can refer to it and learn to implement a UI list of friends on Unity.

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.