Want to incorporate Facebook in your Unity game? have a look at the Facebook SDK for Unity it’s free, easy to use, contains examples and does what it promises :) note: currently in beta! (warning, does not support desktop applications yet!)
A quick setup:
– Import the assets from the above link into your project.
– Create a custom script to handle Facebook calls.
– Add using Facebook.Unity; so we can use the FB class
– Add using Facebook.MiniJSON; so we can process the received data that we get from the HTTP requests that we are going to do.
For everything else there are many example code and scenes in the added asset. Furthermore you can access the SDK documentation by going to Facebook > SDK Documentation:
Some things to keep in mind / to do:
– For android builds, make sure the minimum API level is the same in both the projects manifest and the one you get from importing the asset, otherwise you will get a “Unable to merge android manifests. See the Console for more details” error when trying to build. The SDK uses API level 15 which is android 4.0.3 “Ice Cream Sandwich”. If you set your project API level to 15 (in build settings > player settings > android tab > other settings > Identification > minimum API level) then it should work fine.
– There are 2 ways to initialize FB. If you use: “FB.Init(this.OnInitComplete, this.OnHideUnity);“. Then make sure you’ve set the App data in the facebooksettings. Otherwise you’ll get a message stating “You didn’t specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor.”
– If you have trouble generating the android manifest and it’s saying “Keytool not found” then make sure you’ve installed Java and the JAVA_HOME variable is set right and you’ve added the right folder to the PATH variable. You can access your system variables (on win10) by going to “this PC” and right click it and select properties > Advanced system settings > Environment Variables