Sign In Register

How can we help you today?

Start a new topic
Answered

Unity LogEventRequest_findPlayer

 Hello,


I'm trying to import social friends system to my game. I couldn't find how to use this in unity. Can you help me please?

public void FindFriends(string displayName, long entryCount)
	{
		for(int i = 0; i < findFriends.Count; i++)
		{
			Destroy(findFriends[i]);
		}
		findFriends.Clear ();

		new LogEventRequest_findPlayer ().Set_displayName (displayName).Set_entryCount (entryCount).Set_offset(0).Send ((response) =>
		{
			"?"
		});
	}

  


Best Answer

Here is the answer;


public void FindFriends(string displayName)

 {

  for(int i = 0; i < findFriends.Count; i++)

  {

   Destroy(findFriends[i]);

  }

  findFriends.Clear ();

  new LogEventRequest_findPlayer ().Set_displayName (displayName).Set_entryCount (1).Set_offset(0).Send ((response) =>

  {

   var gsData = new GSData(response.ScriptData);

   object[] friendslist = gsData.GetObjectList("player").ToArray();

   foreach(var find in friendslist)

   {

    var dic = (Dictionary<string, object>)find;

    string playerID = dic["playerId"].ToString();

    Debug.Log(playerID);

   }

  });

 }

1 Comment

Answer

Here is the answer;


public void FindFriends(string displayName)

 {

  for(int i = 0; i < findFriends.Count; i++)

  {

   Destroy(findFriends[i]);

  }

  findFriends.Clear ();

  new LogEventRequest_findPlayer ().Set_displayName (displayName).Set_entryCount (1).Set_offset(0).Send ((response) =>

  {

   var gsData = new GSData(response.ScriptData);

   object[] friendslist = gsData.GetObjectList("player").ToArray();

   foreach(var find in friendslist)

   {

    var dic = (Dictionary<string, object>)find;

    string playerID = dic["playerId"].ToString();

    Debug.Log(playerID);

   }

  });

 }

Login to post a comment