1. Create Facebook App
2. Set Facebook App Key Hash
3. Install OpenSSL
4. Install JDK
5. Set environment variable
6. Download & import Unity Facebook SDK
7. Confirm Bundle ID & Keystore
8. Modify AndroidManifest Merge
Create Facebook App
First goto Facebook Developer Page to be a developer of Facebook, then goto
My Apps => Add a New App
Select your platform
Usually we start from Android for Unity development, so the article example will also choose Android.
Naming is the most difficult part…
Anyway, that’s consider a good name!
Package & Activity Name
The default Activity class name for Unity is
Create Key Hashes
Details：How to generate Android Key Hash
The above article is generating on MacOS, if you’re using Windows just skip this step first.
You will need your Facebook App ID in Unity.
Download Facebook SDK
Create new Unity project & import Facebook SDK
Facebook => Edit Setting
OpenSSL not found
Fill your Facebook App Id first, then expand Android Build Facebook Setting below, confirm is everything alright.
If you don’t install OpenSSL, you might have the following message:
OpenSSL not found. Make sure that OpenSSL is installed, and that it its in your path.
Copy the extract directory to wherever you want. I just put it into Program Files.
Add OpenSSL path into environment variable
Then restart Unity.
Ex. C:\Program Files\OpenSSL\bin
Keytool not found
After solving OpenSSL problem, you will meet another message if you don’t install JDK.
Add JDK environment variable
Just the same step like OpenSSL.
Ex. C:\Program Files\Java\jdk1.8.0_25\bin
Confirm Bundle ID
Be sure it’s equals to the one in your Facebook Console.
Add all Example Scenes into Build Settings, put the MainMenu Scene for the first.
Unable to merge android menifests
You might meet the final problem: Different version of Menifests.
You can see the minSdkVerion & targetSdkVersion in Log.
Add SdkVersion into the Main Manifest.xml
Click the FB.Init button first.
Be sure to use your developer account.
You can use FacebookManager on my Github for shortcut.
m_fbManager = new FBManager(); m_fbManager.LoginCompleteEvent += OnFBLoginComplete; m_fbManager.ErrorEvent += OnFBError; m_fbManager.Login(); m_fbManager.Snapshot( texture, title, fileName );
歡迎您留言與分享！(Welcome for comments or sharing!)
- [Facebook] How to generate android hash key
- [Unity] About MovieTexture