Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by rohan-more · Aug 14, 2017 at 07:15 PM · unity 5facebooksdk

Facebook SDK 7.10- Unity 2017 - Display Profile Picture

Hi, I get IGraphResult as null, hence the texture as null too. Here is the API call:

 FB.API("me/picture?type=square&height=128&width=128", HttpMethod.GET, DisplayPhoto);

Here is the callback function:

 void DisplayPhoto(IGraphResult result)
         {
             if (!string.IsNullOrEmpty(result.Error))
             {
                _profilePic.sprite = Sprite.Create(result.Texture, new Rect(0, 0, 128, 128), new Vector2());
             }
             else if(result.Error == null)
             {
                 Debug.Log("heeeeee " + result.Error);
             }
         }
 

   

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by Lewey100 · Feb 26, 2018 at 07:43 PM

Hi, I'm not sure if you fixed this issue but I have been trying to tackle it all day. You can get the direct image URL using this:

 FB.API("/me/picture?redirect=false", HttpMethod.GET, ProfilePhotoCallback);


Then you can use that URL to download the image file directly. I know its a silly way of doing it considering the API used to work out the box but it'll get you your image! Here is the code below to get the image using the URL:

 private void ProfilePhotoCallback (IGraphResult result)
  {
      if (String.IsNullOrEmpty(result.Error) && !result.Cancelled) { //if there isn't an error
          IDictionary data = result.ResultDictionary["data"] as IDictionary; //create a new data dictionary
          string photoURL = data["url"] as String; //add a URL field to the dictionary
  
          StartCoroutine(fetchProfilePic(photoURL)); //Call the coroutine to download the photo
      }
  }
  
  private IEnumerator fetchProfilePic (string url) {
      WWW www = new WWW(url); //use the photo url to get the photo from the web
      yield return www; //wait until it has downloaded
      this.profilePic = www.texture; //set your profilePic Image Component's sprite to the photo
  }


Hope this helped!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by mibo90 · Aug 15, 2017 at 10:30 AM

Same problem here. Apparently from what I could find out so far there is no fix. We need to wait for Facebook to update the Unity SDK. It seems there are workarounds, but they involve a lot of fiddling with the request/response. There is no date set for the new Facebook SDK as of 15-Aug-2017, but I imagine soon... fingers crossed. Here's a link with more details: https://developers.facebook.com/bugs/341638962932484/

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Cookieg82 · Aug 15, 2017 at 12:52 PM 0
Share

That thread has been closed by Facebook - Irritating as they have not left it open to update on a workaround?

avatar image
0

Answer by satanas · Feb 12, 2018 at 06:40 AM

Try with a forward slash before "me":

FB.API("/me/picture?type=square&height=128&width=128", HttpMethod.GET, DisplayPhoto);

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Olamire · Jul 11, 2020 at 09:38 PM 0
Share

Thank you soooo much

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

184 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[HELP URGENT] Resolving dependencies. 0 Answers

Unity Facebook SDK v7.9.0 totally doesn't work on iOS (Unity version 5.3.2) 1 Answer

Getting Player Picture with bad request in unity 5 1 Answer

Failed to re-packages resources. (It's started happened after i imported facebook 7.9.0 sdk) Unity 5.5 1 Answer

FacebookSDK 7.10 - Unity 2017 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges