从IResult获取纹理 - Facebook SDK Unity 7.1.0

时间:2015-10-07 02:29:24

标签: facebook-unity-sdk

我尝试在登录成功后从Facebook获取用户头像。 我以前用“FBResult.Texutre” 但似乎新的sdk版本中没有提供IResult或IGraphResult中的纹理属性。 请帮忙!感谢。

2 个答案:

答案 0 :(得分:0)

我找到了解决方案:

  • using UnityEngine; Texture2D Texture { get; }添加到IGraphResult.cs
  • public Texture2D Texture { get; private set; }添加到GraphResult.cs
  • this.Texture;添加到GraphResult.cs
  • 中的GraphResult构造函数

现在你可以从IGraphResult获得纹理

示例:

void GetAvatar(IGraphResult result){ ... result.Texture ... }

答案 1 :(得分:0)

This is fixed in the latest version of the SDK. Simply use the Texture field from IGraphResult.

FB.API("/me/picture", HttpMethod.GET, delegate(IGraphResult result) {
  if (result.Texture != null) {
    // use texture
  }
});