This guide provides step-by-step instructions to implement the Facebook Unity SDK.
The Facebook Unity SDK works with Unity 5.0 and above.
In your app dashboard under Settings > Basic, copy your App ID.
Step 1: Create a new project in the Unity Editor.
Step 2: Download the latest Facebook SDK. Unzip this package after downloading. The code for this sample project will be included.
Step 3: In the Unity editor, select Assets > Import Package > Custom Package… Navigate to the directory where you downloaded the Facebook for Unity SDK and select
FacebookSDK.unitypackage. Note: You will need to remove previously integrated Facebook SDK packages before importing a newer version.
Step 4: Import all assets in the package.
Step 5: Save your project. A post-build script will add a Facebook menu item to the Unity editor. If you don't see this, check your build for compilation errors and try building again.
Step 6: In the Unity editor, select Facebook > Edit Settings.
In the Inspector FacebookSettings, paste in your Facebook App ID.
Step 1: In the Project panel, under Assets > FacebookSDK, you will find all the files for the Facebook Unity SDK. Open the folder titled Examples. Double click on the MainMenu scene to open the sample project menu.
Step 2: In the Unity editor, select File >Build Settings.
Select all the Unity Scenes in the Examples folder and drag them over to the Build Settings panel. Drop them in Scenes In Build. Drag the MainMenu scene to the
0 position, the first position in the list.
Step 3: Enter Play mode to run our example code for a simple demo of the Facebook SDK functionality.
Note: The Unity editor environment offers limited functionality, and all the functions are stubbed. It is safe to ignore any warnings or errors regarding the inability of the example game to reach Facebook.