- Home /
Question by
radiktus · Feb 12, 2015 at 03:34 PM ·
facebookleaderboard
facebook GetPictureURL logs different URLs, but shows same texture2d image
I used unity 4.6 ui to create a simple friend leaderboards, I am getting the correct names and scores but the sprite for the friends profile picture is all the same! I logged it to check if the proper image urls are being loaded and it does, I dont get why I am getting the same image.
here is how i load the friends list
IEnumerator setFriendList()
{
foreach(object friend in friends)
{
Dictionary<string,object> entry = (Dictionary<string,object>) friend;
string name = (string) entry["first_name"];
string id = (string) entry ["id"];
Texture2D picture = null;
while(picture == null)
{
yield return null;
LoadPicture(Util.GetPictureURL(id, 128, 128),pictureTexture =>
{
if (pictureTexture != null)
{
Debug.Log("image loaded from url "+id);
picture = (Texture2D)pictureTexture;
}
});
}
FbFriend fr = new FbFriend(name,id,Random.Range(100,100),picture);
friendlist.Add(fr);
if(friends.LastOrDefault() == friend)
{
doneLoadingPicture = true;
}
}
}
sadly picture is returning the same sprite for every friend even though the names and scores are correct.
Comment