我正在尝试使用此方法获取游戏用户的个人资料图片-
void MyPictureCallback(FBResult result) // store user profile pic
{
if (FB.IsLoggedIn)
{
WWW url = new WWW("http" + "://graph.facebook.com/" + FB.UserId + "/picture");
Texture2D textFb2 = new Texture2D(128, 128, TextureFormat.ARGB32, false); //TextureFormat must be DXT5
url.LoadImageIntoTexture(textFb2);
profilePic.renderer.material.mainTexture = textFb2;
}
但它不起作用。我没有收到任何错误。
Jason Pietka 的答案很好,但有点旧。
今天我们我们FB.API
:
FB.API("me/picture?type=med", Facebook.HttpMethod.GET, GetPicture);
GetPicture
是一个回调方法,所以:
private void GetPicture(FBResult result)
{
if (result.Error == null)
{
Image img = UIFBProfilePic.GetComponent<Image>();
img.sprite = Sprite.Create(result.Texture, new Rect(0,0, 128, 128), new Vector2());
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)