Sing In

First of all, need to Init the facebook SDK. using the Init method. The Init method set the state of the Facebook SDK, and initializes all platform-specific data structures and behaviors. This function can only be called once during the lifetime of the object; later calls lead to undefined behavior.

It relies on properties that are set in the Unity Editor. See the example below:

using SA.Facebook;
...

SA_FB.Init(() => {
    Debug.Log("Init Completed");
});

Before you init, you might want to fill some Facebook settings via the code, for example, to set some app scopes. app Id, etc

using SA.Facebook;
...

//This can be done via editor menu 
SA_FB_Settings.Instance.SetAppId("1605471223039154");


//This can also be done via the settings
//We need email scope to be able to get user email
if(SA_FB_Settings.Instance.Scopes.Contains("email")) {
    SA_FB_Settings.Instance.Scopes.Add("email");
}

if(SA_FB_Settings.Instance.Scopes.Contains("user_photos")) {
    SA_FB_Settings.Instance.Scopes.Add("user_photos");
}

SA_FB.Init(() => {
    Debug.Log("Init Completed");
});

You do not have to use code to set the facebook settings, you can do this using the plugin Service UI. Select the Facebook service page.

Under the Facebook service page, you will find the Official Facebook SDK setting UI + Additional settings you may set for the Ultimate Facebook plugin.

You may also use the IsInitialized property if you need to find out if SDK was already invited or not:

using SA.Facebook;
...

bool isInitialized = SA_FB.IsInitialized;

Once API is inited, you may start user sing-in flow, see the code sample below:

using SA.Facebook;
...

if (!SA_FB.IsLoggedIn) {
	SA_FB.Login((result) => {
        if(result.IsSucceeded) {
            Debug.Log("Login Succeeded");
        } else {
            Debug.Log("Failed to login: " + result.Error.FullMessage);
        }
    }); 
}

You may also use the IsLoggedIn property if you need to find out if a user is currently logged in.

using SA.Facebook;
...

bool isLoggedIn = SA_FB.IsLoggedIn;

Once the user is logged in, you can now use any FB API you need. I would recommend starting from retrieving the user profile information, so you would able to display his name and avatar in your application.

You may also log out any time with the LogOut method.

using SA.Facebook;
...

SA_FB.LogOut();