Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Am using Unity, with PUN and FB Integration. How to get my friends list?

Discussion in 'Android' started by babji3, Apr 28, 2019.

  1. babji3

    babji3

    Joined:
    May 28, 2015
    Posts:
    179
    Hi developers, i implemented Photon with Facebook in unity to do Friends List and chat. And i found one asset, when i login i got this error that dictionary is null Here is the Asset link and error.
    https://github.com/vironitcom/Unity_PlayWithFriendsKIT
    Code (CSharp):
    1. private void GetInfoForChat(IResult result)
    2.     {
    3.         UserID = result.ResultDictionary["id"].ToString();
    4.         var dictionary = (Dictionary<string, object>)Facebook.MiniJSON.Json.Deserialize(result.RawResult);
    5.         var friendsDict = (Dictionary<string, object>)dictionary["friends"];
    6.         var friendsList = (List<object>)friendsDict["data"];
    7.         UserFriendsID = new List<string>();
    8.         UserFriendsName = new Dictionary<string, string>();
    9.         foreach (var dict in friendsList)
    10.         {
    11.             UserFriendsID.Add(((Dictionary<string, object>)dict)["id"].ToString());
    12.             UserFriendsName.Add(((Dictionary<string, object>)dict)["id"].ToString(), ((Dictionary<string, object>)dict)["name"].ToString());
    13.         }
    14.         ///Start chat
    15.         Connect();
    16.     }
    and the error was Keynoyfound. Previous it is working well.

    Thanks, am strugling in this.