using System.Collections; using System.Collections.Generic; using UnityEngine; public class AvatarList : MonoBehaviour { public GameObject Avatar; public void Init() { if (this.transform.childCount <= 0) { NetWorkHeaders.GetUserAvater((aData) => { for (int i = 0; i < aData["data"]["user"].Count; i++) { GameObject avatarobj = Instantiate(Avatar, transform) as GameObject; if (avatarobj) { AvatarToggle avatarToggle = avatarobj.transform.GetComponent(); if (avatarToggle) { avatarToggle.Init(aData["data"]["user"][i].ToString()); NetWorkHeaders.Instance.getNetTexture(aData["data"]["user"][i].ToString(), null, (Texture tex) => { if (tex) { avatarToggle.Init(tex); } }); } } } }); } } }