Need help with Facebook Integration

Hi all.

I try to use the last facebook sdk and have a lot of problems and bug. There is a unity plugin for facebook or its olny the facebook sdk? anyone has a tutorial of how to implement that?

thanks

There is alot of tuts on how to add Facebook. Follow them step by Step let us know the issues your having then maybe we can help, make sure you download the SDK first…

I know it costs money but the prime 31 plugin is really easy to use when adding Facebook support

nice thanks!

Definitely recommend the Prime 31 plugin for social media integration. They are on top of their products and have plugins that just work.

1 Like

thanks guys, but i need something free, dont have money at the moment =/

@Recon03

this is the errors when I try to share something with facebook sdk. another error, is the size os facebook window. theres a way to fit to my screen size?

and here is my code. I put this script on an empty gameobject

using UnityEngine;
using System.Collections;

public class FBscript : MonoBehaviour {

    void Awake(){
        FB.Init(SetInit, OnHideUnity);
    }
    // Use this for initialization
    void Start () {


    }
   
    // Update is called once per frame
    void Update () {
   
    }

    public void ShareButton(){
        if(FB.IsLoggedIn) {
            FB.Feed(linkCaption:"loren ipsum",
                    picture: "",
                    linkName: "download now!",
                    link: "http://apps.facebook.com/" + FB.AppId + "/?challenge_brag=" + (FB.IsLoggedIn ? FB.UserId : "guest")
                    );
        } else {
            FB.Login("email", AuthCallback);
        }
    }

    private void SetInit() {
        enabled = true;
        // "enabled" is a magic global; this lets us wait for FB before we start rendering
    }
   
    private void OnHideUnity(bool isGameShown) {
        if (!isGameShown) {
            // pause the game - we will need to hide
            Time.timeScale = 0;
        } else {
            // start the game back up - we're getting focus again
            Time.timeScale = 1;
        }
    }

    void AuthCallback(FBResult result){
        if (FB.IsLoggedIn) {
            Debug.Log("logged");
        }
        else {
            Debug.Log("fail");
        }
    }

}

anyone can help me please

You need a new access token yours has expired hit on access token that will transfer you to facebook developer account page and bring up a token copy it and paste it as login info then hit log in should do.

let me know what happens.

regards.

1 Like

Now I get another error… the access token window dont appear, and this error shown. anyone knows what is that?

in my code i just call the SetInit method

public void SetInit(){

        if (FB.IsLoggedIn) {
            OnLoggedIn();
        }
        else {
            FBLogin();
        }
    }

    void FBLogin(){
        FB.Login ("email", AuthCallback);
    }

    void AuthCallback(FBResult result){
        if (FB.IsLoggedIn) {

        }
    }