Currently I am accessing the data top 10 ranker of facebook. But in the callback i am not able to get the profile image of the all 10 ranker.
public class UnityCallBackUserId :MonoBehaviour, App42CallBack
{
List<string> fbplayer=new List<string>();
public void OnSuccess(object response)
{
WWW www;
Game game = (Game) response;
Debug.Log("gameName is " + game.GetName());
Debug.Log ("scorelist"+game.GetScoreList().Count);
foreach(Transform child in FindRankOnGameOver.instance.scroolview.transform)
{
GameObject.Destroy(child.gameObject);
}
for(int i = 0;i < game.GetScoreList().Count; i++)
{
fbplayer.Add(game.GetScoreList()[i].GetUserName());
// Debug.Log("userName is : " + game.GetScoreList()[i].GetUserName());
Debug.Log("userName is : " + game.GetScoreList()[i].GetUserName());
Debug.Log("score value is : " + game.GetScoreList()[i].GetValue());
Debug.Log("scoreId is : " + game.GetScoreList()[i].GetScoreId());
Debug.Log("Created On : " + game.GetScoreList()[i].GetCreatedOn());
Debug.Log("Facebook id is : " + game.GetScoreList()[i].GetFacebookProfile().GetId());
Debug.Log("Facebook name is : " + game.GetScoreList()[i].GetFacebookProfile().GetName());
Debug.Log("Facebook picture is : " + game.GetScoreList()[i].GetFacebookProfile().GetPicture());
GameObject friendsentry;
friendsentry=Instantiate(FindRankOnGameOver.instance.friends)as GameObject;
friendsentry.transform.parent=FindRankOnGameOver.instance.scroolview.transform;
Transform picture=friendsentry.transform.Find("Image");
Image fbpic=picture.GetComponent<Image>();
www = new WWW(game.GetScoreList()[i].GetFacebookProfile().GetPicture());
fbpic.sprite=Sprite.Create(www.texture,new Rect(0,0,128,128),new Vector2(0,0));
Transform name=friendsentry.transform.Find("Name");
Transform score=friendsentry.transform.Find("Score");
Text fbname=name.GetComponent<Text>();
Text gamescore=score.GetComponent<Text>();
fbname.text=game.GetScoreList()[i].GetFacebookProfile().GetName();
gamescore.text=game.GetScoreList()[i].GetValue().ToString();
FindRankOnGameOver.instance.scrolpanel.SetActive(true);
}
}
public void OnException(Exception e)
{
//Enable all the colliders
Debug.Log("Exception : " + e);
}
}
i am getting all the things except profile image. i am getting the error like image cannot downloaded yet or downloading is not completed yet but to trying to acess it. it tryed to use coroutines but i dont know how to use in for loop. please help me in that i never used www.