Setup

Step 1: Navigate to your App Dashboard and click '+ Create New App'. In the popup dialog, give your new app a name and optionally a unique namespace, click 'Continue' and follow the subsequent instructions.

Step 2: Once you complete, you'll see your app's Basic Settings page. Here you can find your App ID, which is required within your Unity games configuration, in order to integrate with Facebook.

 

Step 3: Open project with imported plugin. Select 'Edit Settings' from the 'Facebook' menu.

 

Go to your app settings on facebook

 

Click on Add Platforms and add IOS and Android platform

 

IOS Setup Part:

Set your app bundle Id. You can also specify IPhone and IPad Store ID if you have one.

 

Android Part.

Set your app bundle id (Package Name). Use com.facebook.unity.FBUnityDeepLinkingActivity as Class Name. Set the Key hash for you app

 

You can use Debug Key Hash or get one from your app Keystore.

To get Debug Key Hash use:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

Note:  That command should be used in terminal.

 

For Windows:

  1. Download the open ssl for windows here
  2. now unzip to c drive
  3. open cmd prompt
  4. type cd C:\Program Files\Java\jdk1.6.0_26\bin
  5. then type only keytool -export -alias myAlias -keystore C:\Users\your user name\.android\myKeyStore | C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e
  6. Done

password: android.

 

If you already have your keystore, use this to get Key Hash:

keytool -exportcert -alias <alias_name> -keystore <path_to_keystore> | openssl sha1 -binary | openssl base64

If you don’t have, you can use this instruction to create your app keystore.

Note:  you can create Keystorestore, in any way you like. Just make sure you specified Key Hash FB app setting accordingly to keystore you are building with.

Warning: The Key Hash you see when you open the Facebook → Edit Settings is a key for an unsigned debug app. This is not the Key Hash you should use in the Facebook App Dashboard. Use the Keystore to create your key hash.

 

Note: More detailed guide of FB setting can be found here.

 

Step 4: Specify login scopes

Open plugin setting window. Window → Mobile Social Plugin -> Edit Settings

You can leave default permissions or change if you need more. You can see here all available scopes and their descriptions.

Note: Including publish_actions triggers a Facebook review.

The basic permissions that don't require a review are:

  • public_profile
  • email
  • user_friends

But without publish_actions you will not be able to use

SPFacebook.instance.Post

 

After you have done testing FB API in your game, you need to send your app for review (only if use using permissions which requires Facebook review).

Go to your app settings under the Status & Review tab and click Start Submission button.

In the popup window check all permissions you would like to use with your app, and send your application for a submission. After your app is approved, Status & Review page will look similar to this.

 


Now you can go to the next guides to find out how to use Facebook and API in your app.