Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by cjrichards · Sep 15, 2012 at 12:40 AM · wwwfacebookflashpublicprivate

Has anyone had success with Facebook's graph API in Unity's Flash export?

I am trying to pull information from Facebook (such as a user's feed, photos, friends, etc.) into an app that I am exporting to Flash, but I can't seem to receive any information except for very basic information from graph.facebook.com/me (and permissions). I am trying to use Unity's WWW class like so:

 WWW www = new WWW("https://graph.facebook.com/me?access_token=" + myAccessToken);
 yield return www;

Using this format--and a few other methods using actionscripts--I have so far been successful in redirecting users to the Facebook authentication page, accept additional necessary permissions (for reading a user's feed, viewing photos, etc.), return the user to my webpage with the flash app and an access code in the URL, read the code and use the WWW class to get the correct access token, store the token as a user preference, and finally query Facebook for information by using the access token.

As mentioned before, I can return some basic public information; however, I can't get private information--and even some public information such as friends. What troubles me most is that www.error is returning null while www.text simply returns an empty string ""; there should be an error if the access_token doesn't have correct permissions, and www.text should return something like "{ data:{} }" if an empty list is being returned. I've even tested the access_token in Facebook's "Graph API Explorer" page and I can access all the data to which I've granted permissions.

Has anyone else attempted accessing Facebook from a Unity3d Flash export? I could really use some ideas because I am running out. I've convinced myself it is some issue with the way that flash is using WWW because I have successfully returned a list of friends by running it from within Unity by pre-fetching my access_token and hardcoding it in.

Also, if anyone has successfully connected to Facebook through some method other than WWW, please let me know. I am open to other options.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by cjrichards · Sep 17, 2012 at 07:59 PM

For anyone who is interested, I've found a solution from a different post--though the poster was having a slightly different issue:

http://answers.unity3d.com/questions/266934/getting-fatal-error-2030-using-www-in-flash.html

Basically, WWW still has a few bugs in the current Unity3d's flash export. The solution is to perform your http functions in an AS3 file while mirroring function and variable names in a .cs file (I assume javascript would work too?), using [NotRenamed] and [NotConverted]. Then you can call your AS3 functions from within your Unity3d app. More details are included in the link above. You can find more info on [NotRenamed] and [NotConverted] in Unity's script references.

One other thing to note: Even after converting my app to use AS3, I had an additional problem. By default, Facebook will return ALL of the info from your feed, list of friends, etc.; this was creating a "Fatal Error: null" because of buffer overflow (I think). Setting a limit on the amount of information returned (by adding ?limit=5 to the url, for example) fixed this issue. If this isn't an option for someone, maybe there is a way to modify the size of the buffer? If anyone knows how to do this, share your knowledge here for someone else's sake! (I haven't looked it up because I am fine with a size limit for now)

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

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

9 People are following this question.

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

Related Questions

unity flash working with my local browser,but when uploaded via heroku doesnt run!help please 0 Answers

Playing Videos in a Flash build 4.2.2 2 Answers

WWW Flash player with Unity 3.5 1 Answer

Flash WWW.texture problem 2 Answers

Changing variable values not having any effect 2 Answers


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