Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Closed] Social Networking Plugin (Facebook and Twitter) live!

Discussion in 'iOS and tvOS' started by prime31, Sep 19, 2010.

  1. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    The Social Networking plugin just went live! It has support for Facebook and Twitter. For both, it will cache the OAuth login tokens for you so that you only need to grab a users credentials once. The Twitter support is full xAuth which means there is no need to redirect to the Twitter web page to log the user in.


    Plugin page: Prime31 Plugins
    Social Networking docs available here

    Quick Update: be sure to check the docs for links to Facebook and Twitter's developer centers so that you can get a jump start on getting your API access.


    Coming soon is the Etcetera plugin that will have a bunch of goodies and helpers that don't fit into any particular categories. It will have a nice alert popup prompt that can take in 1 or 2 lines of text and can be styled to match your game along with web view, photo-to-texture, email composer, Apple alert view and more. For an example of the popup prompt see the attached images.
     

    Attached Files:

  2. mehware

    mehware

    Joined:
    Nov 19, 2007
    Posts:
    739
    Great job! Keep it up! I'll be getting this in the near future.
     
  3. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    Bought!

    You're doing a great job in knocking out these plugins so quickly! Reasonable prices too I think.

    Looking forward to your next one...
     
  4. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @MattSimpson, the goal is just that: to provide super easy to integrate plugins that cost far less than it would be to make them yourself. If you can buy a plugin for $30 that would take 6-10 hours to make yourself it's a no brainer. Those hours are better spent making kick-ass Unity games.
     
  5. liquidgraph

    liquidgraph

    Joined:
    Feb 26, 2009
    Posts:
    324
    This is great. Just what I've been looking for. I just applied for xAuth for Twitter and set up my Facebook app. Two questions:

    1. How hard is it to get xAuth approval from Twitter? Reading their xAuth docs it seemed like they're pretty restrictive about it.

    2. Does your Facebook implementation use the new Facebook GraphAPI or the old one?
     
  6. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @liquidgraph, I have never heard of Twitter denying xAuth for a mobile app. The Facebook code is using the new Graph API.
     
  7. liquidgraph

    liquidgraph

    Joined:
    Feb 26, 2009
    Posts:
    324
    Thanks, this release has made my day.

    Edit: Do your plug-ins require Unity iPhone Pro, or they work with iPhone Basic too?
     
  8. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    Hi Prime

    I've just upgraded to Unity 3 and I will be purchasing a plug-in or two very soon. I've been very interested in this one especially for Facebook connect.

    For other games that I've played in the past on my iPhone that have Facebook Connect in it the posts on my wall seem to have the following elements.

    - A title
    - An image on the left hand side which also is click-able (I.E. hyperlink to either their website etc)
    - The main description on the right hand side
    - An optional secondary hyperlink with custom label on the right hand side as well.

    It doesn't look like the plug-in has a method to do all of this within the one method call (thus in the one Facebook post), ... are you planing to extend your FB plug-in to include this or is it easy to extend this ourselves?

    Cheers,
    Dean
     
  9. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @dcp468, I'll have a look through the API to see exactly what the procedure is to get a post like the one you describe.
     
  10. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @dcp468, is the attached image what you are looking for?
     

    Attached Files:

  11. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    Yes, absolutely, ... 100%

    Having such a rich Facebook post (Title, clickable Image, description, other links to your facebook page for your game and/or app store etc) is great for self promotion of your game among the players FB friends.

    Cheers,
    Dean
     
  12. liquidgraph

    liquidgraph

    Joined:
    Feb 26, 2009
    Posts:
    324
    So I'm confused, does the Social Networking plugin allow for "rich" Facebook posts at this time, or is that still in development and slated as an update?
     
  13. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @liquidgraph, the post in the image is from the currently released plugin. See the postMessageWithLinkAndLinkToImage method form the docs.
     
  14. Hoff

    Hoff

    Joined:
    Jun 20, 2010
    Posts:
    223
    I think there is a way to embed an image without having to link to one stored on an external server. I'd have to check the FB API.
     
  15. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Hoff, there is. It is the postImage method.
     
  16. Hoff

    Hoff

    Joined:
    Jun 20, 2010
    Posts:
    223
    Ah, I missed that one :)
     
  17. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    Hi Prime

    Just got the social plugin and have to say the setup couldn't be easier, ... and I still cannot get over the fact that we can have these features with Unity 3 by default.

    Regarding the Login page that pops up:
    (1) there use to be a close button on the older facebook connect login dialog, ... does this not exist anymore. How can a user close the dialog if a user doesn't want to login or change their mind? I notice it's still there even if you exit and start unity again, so you cannot get the dialog to disappear.
    (2) Can the login dialog be displayed in landscape if your game is in landscape?
    EDIT: The landscape issue is working correctly now, ... not sure why however I'm now using Unity F5 whereas before I was using Unity F3. Maybe there was a bug in it.

    Possible FB enhancements to Social Plugin (based on what I've seen elsewhere in other games)
    - Once a user logs-in and ALLOWS the app to access their basic information (I.E. profile picture). It would be cool to be able to display their profile pic within Unity while they're logged in.

    I've tried the FB login with your Facebook app and mine (see both pictures). Why does your app ask for Access my basic information where mine doesn't. Is there a setting within your FB app.

    EDIT: Regarding the CLOSE button on the login dialog, ... there's one there in the TOP RIGHT however you cannot see it, and I swear it didn't work the other day because I tried it several times. Weird. However the close button seams to be invisible.

    Cheers,
    Dean
     

    Attached Files:

    Last edited: Sep 28, 2010
  18. robin_notts

    robin_notts

    Joined:
    Apr 7, 2010
    Posts:
    86
    Are there any plans with this to support twitter querying? Also, it would be great if it also worked on other platforms, if this isn't the case already.
     
  19. maglat

    maglat

    Joined:
    Jul 9, 2010
    Posts:
    111
    Hey Prime,

    Today I bought your plugin but I need a bit help to get start.
    After inserting my Facebook App ID in FacebookBinding.init( ) and I start your testscene with that nice gui , I click at the Facebook "Login" button, but nothing happens.
    The Facebook loginscreen didnt appear. What can I do make it work?
    I'm using the the "Unity Iphone Basic Edition" in version 3.0.0.5F.

    Greetings Maglat
     
  20. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    @Maglat, ... It doesn't work in the Unity editor if that's where you're trying to invoke the login dialog. You have to first build it "Do a Build (not a Build and Run)" then start it within Xcode. You have to test this on your device for it to work.
     
  21. maglat

    maglat

    Joined:
    Jul 9, 2010
    Posts:
    111
    @dcp468: OH! Sorry I never tryed that before. I wonder why not? ^^

    EDIT: After buliding and running the plugin at my iphone, everthing works fine :) Now I'm happy :)
     
    Last edited: Sep 28, 2010
  22. maglat

    maglat

    Joined:
    Jul 9, 2010
    Posts:
    111
    @prime31

    I have one request. Is it possible to add a cancel button to the Facebook login dialog. That would be very handy :)
     
    Last edited: Sep 28, 2010
  23. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @maglat, the Facebook login dialog is actually pulling in the Facebook webpage (keeps snooping developers from seeing users passwords). That being said, there is a small 'x' in the top corner of the dialog that cancels the login and closes the dialog.
     
  24. maglat

    maglat

    Joined:
    Jul 9, 2010
    Posts:
    111
    Thanks for your prompt replay! :)
    Your right! When I touch the on the top corner of the dialog, the dialog get closed. But the strange thing is that the litte "X" didn't show up / is invisible.
     
  25. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @maglat, the missing x is odd. I'll give it a look and see if I can figure out how/why that may be happening.
     
    Last edited: Sep 29, 2010
  26. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    Yes I can confirm that the X or close button is present on the login dialog (see my earlier post) however you cannot see it. It still works however from a UI point of view it would be confusing for customers and not sure if Apple would approve. A weird problem.
     
  27. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    Hi Prime

    I can now see the close button on the FB login page with the latest update. Nice :)

    Thanks.
     
  28. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @robin_notts, twitter querying could be added if it was useful to enough people. What exactly would you want to query?
     
  29. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    Prime

    Possible improvement (based on the old FB connect), ... A FB post that allows the user the BRAG (I.E. enter their own custom message) along with the other components of the post (picture links etc). Is this possible with the newer version?

    Cheers
     
  30. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    dcp, you can post whatever you want with the plugin.
     
  31. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    When a player says reaches a new high score which triggers one of the FB post methods (I.E. postMessage or postMessageWithLink or postMessageWithLinkAndLinkToImage etc) I know in the Facebook Connect days you can have a FB Publish dialog appear for the user to enter their own custom message, ... see attached images as examples. At the moment if a user is logged in I can publish to FB in the background however I don't get a dialog popping up asking me for a custom message like the ones you see below.
     

    Attached Files:

  32. maglat

    maglat

    Joined:
    Jul 9, 2010
    Posts:
    111
    that would be so awesome!
     
  33. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @dcp468, the new GraphAPI doesn't provide a GUI for you but you can most certainly create one yourself and allow the user to input some text.
     
  34. Hilm

    Hilm

    Joined:
    Nov 2, 2007
    Posts:
    338

    I'd also find implementation of this useful*

    Cheers,
    Adam G
     
  35. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    So this is iPhone only? Any chance of including Webplayer / Standalone support? Would love to "write Facebook support once" and have it automagically work depending on the target.
     
  36. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Joe, for now all the plugins are iPhone only. I would like to put together some all platform plugins at some point (including web player, iOS Android and standalone) but that may not be for a bit. Just the act of getting an efficient build and test environment for that and the amount of time for testing alone would blow the cost sky high. It's hard enough testing iPhone, iPad and iPod touch.
     
  37. JamesMobot

    JamesMobot

    Joined:
    Jul 8, 2010
    Posts:
    170
    Sorry if this has been covered.

    Things are running fine and set up was super easy

    Just one question. When the "Allow" screen pops up on the facebook part is that a standard option or is it something we can change via our facebook app if we know a little more on that end?

    I notice it has something about A) allowing access to their public only info and b) allowing to post to their wall.
     
  38. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @RobotsVsWizards, there isn't much you can do with the Allow popup. It is a built in Facebook screen. The plugin is asking for publish_stream permissions due to the fact that it's main purpose is to post on Facebook.
     
  39. gigi

    gigi

    Joined:
    Jun 2, 2010
    Posts:
    8
    I just bought the social networking plugin and it's great. I was able to get posts to my wall very quickly, however I'm having problems getting the name of the logged in user. What steps are needed to return the username to a string? I'm using java not C# if that makes a difference.

    Thanks
     
  40. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @gigi, the C# code from the example scene shows how to get the users name. You can literally copy/paste the C# and just change the string to var and it will work. Be sure to copy the event listener part as well.
     
  41. gigi

    gigi

    Joined:
    Jun 2, 2010
    Posts:
    8
    Thanks for the very quick reply. I will create a test project using your examples so I can see it working.

    But before that, I have another unity related question. Is there a way to detect if the ipod is online? I ask because if you try to log into facebook without a connection, the login page window opens and then closes again instantly. It would be nice to check if the ipod is online first, before trying to connect to facebook so i can avoid the window trying to open.

    Thanks
     
  42. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @gigi, one way to check if it is online is simply use the WWW class to open www.google.com. If you get an error, it isn't online.
     
  43. gigi

    gigi

    Joined:
    Jun 2, 2010
    Posts:
    8
    Thanks for the quick replies Prime31, I've got most things all worked out now :)

    Thanks
     
  44. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,380
    Hi- really hoping to get this working, found out first I had to run from xcode/etc, got to that step, working on my iPod Touch...

    now, however, when i click "login" under Facebook, i just get "["error":["type":"OAuthException","message":"Missing redirect_uri parameter."}}

    googled around a bit but no direct answer so far...any help?
    thanks!
     
  45. dcp468

    dcp468

    Joined:
    Aug 25, 2009
    Posts:
    129
    @yahodahan, ... I believe you have to call FacebookBinding.init method before you call the login method however you only need to do this one time.
     
  46. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @yahodahan, what dcp468 said is exactly right. You have to first call the init method with your appId and appSecret. If you don't, you will get the OAuth exeption every time because Facebook wont be able to validate you as a legit app.
     
  47. Gnimmel

    Gnimmel

    Joined:
    Apr 21, 2010
    Posts:
    358
    Sorry to ask more questions on this plug-in, but I have everything working now and it's great, however I have one more little problem I can't seem to solve. When I use FacebookBinding.postMessageWithLinkAndLinkToImage and add the link, image etc. it all posts fine on facebook, but it also posts a little extra which seems to be the meta tag from the web page it's linked too. To set this up I copied and pasted some old html file and changed a few things so the meta tag is wrong. I changed this and uploaded a new html file to my web site, but it seems to have buffered this somewhere and still prints the old one on facebook. Is there something I've missed? I can't seem to change this last line that gets sent to facebook.

    Thanks,

    Gigi
     
  48. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Gnimmel, there isn't much you do about that one. That is data Facebook stick in there, not the plugin Facebook Connect SDK.
     
  49. gigi

    gigi

    Joined:
    Jun 2, 2010
    Posts:
    8
    Sorry, I'm not Gnimmel, I was using his machine. Anyway, thanks for the quick response. That's annoying that it's not easily changed, but perhaps if we changed the link and renamed our html file it would get the updated meta tag from the new link. The web page is still a early test at the moment so it's easy to change.

    Thanks,

    Gigi
     
  50. gigi

    gigi

    Joined:
    Jun 2, 2010
    Posts:
    8
    Just in case anyone else makes the same silly mistake I did, that fix works. I changed the name of the html file I was linking too and deleted the meta tag so now the I have exactly what I want posted to my wall :)

    Gigi