Unity Community


Page 6 of 119 FirstFirst ... 456781656106 ... LastLast
Results 101 to 120 of 2379

  1. Posts
    6,309
    @sonicviz, almost all of the Facebook methods are asynchronous so you will need to listen to the completion events to know when they are done. The SocialNetworkingEventListener.cs file has examples for how to listen to every available event in the plugin. The 2 you are interested in can be listened to like this:



    Code:  
    1.     void Start()
    2.     {
    3.         // Start listening to the events
    4.         SocialNetworkingManager.facebookLogin += facebookLogin;
    5.         SocialNetworkingManager.facebookLoginFailed += facebookLoginFailed;
    6.     }
    7.    
    8.    
    9.     void OnDisable( string error )
    10.     {
    11.         // Stop listening to the events
    12.         SocialNetworkingManager.facebookLogin -= facebookLogin;
    13.         SocialNetworkingManager.facebookLoginFailed -= facebookLoginFailed;
    14.     }
    15.  
    16.  
    17.     void facebookLogin()
    18.     {
    19.         Debug.Log( "Successfully logged in to Facebook" );
    20.     }
    21.    
    22.    
    23.     void facebookLoginFailed( string error )
    24.     {
    25.         Debug.Log( "Facebook login failed: " + error );
    26.     }


  2. Location
    Brazil
    Posts
    220
    Prime, i'm a little new to C# and never saw "Events" or "Delegates" before, i figured out how to get the userName from Facebook but i do not know how to check if i'm logged in

    It works fine:
    FacebookBinding.getLoggedinUsersName();
    SocialNetworkingManager.facebookReceivedUsername += delegate(string result)
    {
    texto.text = "Welcome " + result;
    };

    but them comes:
    SocialNetworkingManager.facebookLogin += ?????

    and i do not know what to do


  3. Posts
    6,309
    @Paulo, the FacebookBinding.isLoggedIn method returns directly, so you can do something like this:

    Code:  
    1. if( FacebookBinding.isLoggedIn() )
    2. {
    3.      Debug.Log( "user is logged into Facebook" );
    4. }


  4. Location
    Brazil
    Posts
    220
    Quote Originally Posted by Prime31 View Post
    @Paulo, the FacebookBinding.isLoggedIn method returns directly, so you can do something like this:

    Code:  
    1. if( FacebookBinding.isLoggedIn() )
    2. {
    3.      Debug.Log( "user is logged into Facebook" );
    4. }
    I wanted to do something only one time after the login, like changing the player name to the Facebook userName


  5. Posts
    6,309
    @Paulo, in that case, you will want to listen to the facebookLogin event:


    Code:  
    1. // In Start or OnEnable do this
    2. SocialNetworkingManager.facebookLogin += facebookLoginSuccessful;
    3.  
    4. public void facebookLoginSuccessful()
    5. {
    6.       Debug.Log( "logged in" );
    7. }


  6. Location
    Tokyo
    Posts
    790
    Quote Originally Posted by Prime31 View Post
    @sonicviz, almost all of the Facebook methods are asynchronous so you will need to listen to the completion events to know when they are done. The SocialNetworkingEventListener.cs file has examples for how to listen to every available event in the plugin. The 2 you are interested in can be listened to like this:
    Thanks Prime! Got it figured out now. Twitter just gave me xAuth approval too. A little more involved than getting FB approval, but aok in the end.


  7. Location
    San Francisco
    Posts
    93
    this plugin support the new fb single sign-on functionality? http://developers.facebook.com/docs/guides/mobile/

    Also does it support the full graph api calls. Im curious how you build a web or html page on top of unity to allow for proper authorization, with the handshaking of OAuth, the fb uid (which I guess will be encrypted soon) etc
    ---
    Game Developer
    http://TouchFactor.com


  8. Location
    Zürich, Switzerland
    Posts
    26,572
    you don't need to build any on top of unity.
    build the webpage that does this and bridge it and unity through javascript calls in an out


  9. Posts
    6,309
    @gateway69, the plugin exposes a method (graphRequest) that allows you to make just about any graph API request. All the auth happens through the standard Facebook Connect iOS web views which then uses OAuth to make all the requests.


  10. Location
    Brisbane, Australia
    Posts
    62

    News feed

    I'm wondering how you can get facebook posts to show up on the news feed / stream and not just on the users wall?

    Cheers!


  11. Posts
    6,309
    @Tagged, you would have to check the Graph API soca for that one. I am not familiar with everything that it exposes. There is a TON available.


  12. Location
    Brisbane, Australia
    Posts
    62
    Thanks for the quick reply!


  13. Location
    Brisbane, Australia
    Posts
    62
    Been trying to figure it out for a few hours with luck.. If anyone else stumbles on the answer would be very appreciative. Will continue to search otherwise and post if I manage to figure it out.

    Awesome plug-in btw


  14. Location
    Brazil
    Posts
    220
    Prime31, whats the correct way to build my project? Sometimes i get some errors in Xcode and have to rebuild all


  15. Posts
    6,309
    @Paulo, as long as you don't use Build and Run from Unity you should be fine. If you do accidentally do a Build and Run close Xcode, then do a Build followed by a Replace in Unity to rebuild the Xcode project.


  16. Location
    Brazil
    Posts
    220
    Prime, i'm still taming your script hehe, sorry for the amount of posts,

    I saw in some games that uses your plugin that when i left the game, open it again and try to login it auto-connect, without the need of email or pass, how can i do that?


  17. Posts
    6,309
    @Paulo, that will all happen automatically as long as a valid token is still around. You can also use the isLoggedIn method to check manually.


  18. Location
    Brazil
    Posts
    220
    Prime, i cant find this:

    // Shows a dialog allowing a user to edit the message with a link, a name for the link, a link to an image and a caption for the image
    public static void showPostMessageDialogWithMessageAndLinkAndLinkToIm age( string message, string link, string linkName, string linkToImage, string caption )


  19. Posts
    6,309
    @Paulo, it looks like the docs weren't updated with the new name for that method: showPostMessageDialogWithOptions

    I just updated the docs to correct the misnamed method.


  20. Location
    Brisbane, Australia
    Posts
    62
    Prime, just need a little guidance here (sorry if this is a really basic/obvious answer).

    I tracked down an issue with how facebook handles mobile cookies, something to do with logging in multiple ways which I assume is safari and the native facebook app. It spits out an Error 110 when trying to post to a wall because the cookie has been invalidated. Is there a way to detect an invalid cookie login prior to calling showPostMessageDialogWithOptions ? I'm using isLoggedIn already and that comes back as true even with an invalid cookie. Right now to avoid this I'm simply logging out and in each time, which would be annoying for the user!

Page 6 of 119 FirstFirst ... 456781656106 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •