The Facebook SDK for Unity works with Unity 5.0 and above.
No matter what your target platform is, you'll need to start with creating a Facebook App ID for your game. The App ID is used to configure your Facebook SDK within Unity.
If you've never developed a game with Facebook before, or have never registered as a developer, follow the Developer Onboarding Guide first.
Step 1: If you do not already have a Facebook App ID for your app, you should create one:
Step 2: Once completed, you'll see your app's Basic Settings page. Here you can find your App ID, which is required within your Unity game's configuration, in order to integrate with Facebook.
Step 1: Create a new project in the Unity Editor.
Step 2: Download the latest Facebook SDK for Unity from our Downloads page. Unzip this package after downloading. The code for this sample project will be included.
Step 3: In the Unity Editor, select from the menu 'Assets', 'Import Package' and then 'Custom Package…'. Navigate to the directory where you downloaded the Facebook for Unity SDK and select
Step 4: Import all of the assets in the package.
Step 5: Save your project. A post-build script will add a new menu item "Facebook" to the Unity Editor. If you don't see this, check your build for compilation errors and try building again.
Step 6: Select 'Edit Settings' from the 'Facebook' menu.
The inspector will show "FacebookSettings". In the input box under 'App Id:', paste in your Facebook App ID, found as described in the steps above.
Step 1: In the Project panel, under 'Assets', there is a folder named 'FacebookSDK'. Inside this folder are all the files for the Facebook SDK for Unity. Open the folder titled 'Examples'. Double click on the 'MainMenu' scene to open the sample project menu.
Step 2: In the Unity Editor, select from the menu 'File' and then 'Build Settings'.
Select all the Unity Scenes in the 'Examples' folder from above and drag them over to the Build Settings Panel and drop them in the 'Scenes In Build' area. Drag the 'MainMenu' scene to be in order position
0 as below.
Step 3: Enter Play mode to run our example code for a simple demo of Facebook functionality.
Note: The Unity Editor environment offers limited functionality, and all the functions are stubbed. You may receive warnings and errors regarding the game's inability to reach Facebook and read assets from us; it's safe to ignore them.