So with the new FB SDK the coding has changed. I am having an Issue trying to display profile pics and friends list? I know that i am getting the info after login as the debug is telling me but can’t find a way to display them? Any ideas on how to do this? I am trying to get the display pic to show on an image UI??? I know the way to do it from the old SDK but that doesn’t work anymore as of the new Igraphresult coding doesn’t allow it the same way. Any help would be get can post the code i was trying that would work if that helps.
IGraphResult.Texture
will return in the next version of the Facebook SDK for Unity. In the meantime though you can use this workaround:
Texture2D profilePic;
FB.API("/me/picture?redirect=false", HttpMethod.GET, ProfilePhotoCallback);
private void ProfilePhotoCallback (IGraphResult result)
{
if (String.IsNullOrEmpty(result.Error) && !result.Cancelled) {
IDictionary data = result.ResultDictionary["data"] as IDictionary;
string photoURL = data["url"] as String;
StartCoroutine(fetchProfilePic(photoURL));
}
}
private IEnumerator fetchProfilePic (string url) {
WWW www = new WWW(url);
yield return www;
this.profilePic = www.texture;
}
Alternatively, instead of loading it yourself, you can patch IGraphResult so it contains your texture as described here Getting Texture from IResult (Facebook Unity SDK 7.0.3b) - Stack Overflow
I confirm it works.