facebook sdk image loading broken in unity 2017?

I’m testing upgrading a project from 5.6.2 to 2017.1.

The project integrates facebook and loads user profile images. Images load correctly in 5.6.2 but none load in 2017.1.

I was using facebook sdk 7.9.4 and I’ve tried upgrading to 7.10. I get the same fail result with both versions.

Debugging a bit, the FB.API call does NOT return an error result. It just has a null image. There’s also no dictionary in the response to inspect either.

Is anyone having similar problems with 2017 or if someone DOES have fb images loading in 2017, is there something different you’re doing?

This is the basic code I’m using to load an image, say, with url

FB.API("/me/picture?type=square&height=256&width=256",
HttpMethod.GET,
(graphResult) => {
                 
    // graphResult.Texture = null,
    // graphResult.Cancelled = false                
    // graphResult.Error = ""
    // graphResult.Dictionary = null                 
    // graphResult.RawResult = [some binary value]
});

It fails to load any image. I have checked and I’m definitely logged in via the facebook sdk. Using debugger I can see that the response always has a null texture and no result dictionary.

Any help greatly appreciated!

Thanks,
Larry

1 Like

Something goes wrong with FB SDK in Unity 2017

3 Likes

Experiencing the same issue! It’s very frustrating as I am trying to incorporate GameSparks into the callbacks. Which so far has worked except no Profile Picture. I do not want to start using the Util method again, this should work it is a simple request! lol :frowning:

Do you have any further information? Any one at all have any idea what is going wrong?

Downgrade to Unity 5.6.0f3 and use Facebook SDK 7.8 - This fixed it all for me.

I spent a couple of hours today analyzing FB SDK from github. It looks like this is not only FB SDK issue, but complex Unity 2017 + FB SDK. I’ve created a workaround for my project. By adding “&redirect=false” string to the API query. it should looks like:

var queryStr = “/fbid23423423423/picture?g&width=130&height=130&redirect=false”

FB.API(queryStr, HttpMethod.GET, (result) => …

… In this case result.RawResult string looks properly: {“data”:{“height”:130,“is_silhouette”:true,“url”:“https://scontent.xx.fbcdn.net/v/t1.0-1/c38.0.130.130/p130x130/10645251_10150004552801937_4553731092814901385_n.jpg?oh=f48f1ea42b4ef729a13c269688681dfe&oe=5A2645CB”,“width”:130}}

But it comes without Texture due redirect is false. I have to parse url by myself and call Unity’s WWW script to get Texture.

Debug.Log(“Fetching picture from:” + url);
WWW www = new WWW(url);
yield return www;
var texture = www.texture;
Debug.Log(“texture object:” + texture);

Hope it will help you guys!

2 Likes

Excellent. Thanks for the update. Really helpful. It looks as though 2017.1/2 is not supported by Facebook as yet. development lag which is natural.

Any news out there about this?

Thanks!!

As far as I know - I tested the 2017.1 release with the latest FB SDK at the time and it just did not work for callbacks. To answer your question, I would say try 2017.1 and just use an older FB SDK release. In my case, I am using Unity 5.6.0 together with FB SDK 7.9 which works for me. I will attempt an upgrade at some point in the near future.

Are you using the latest Unity release and experiencing issues with the latest FB SDK?

Roll back to an older release on both if so is my advice :wink: