C
C
Candy Smith
General Info
Ask or search…
K
Links

How to setup FaceBook and Leadboard

Facebook Integration

  1. 1.
    Download Facebook SDK
  2. 2.
    Import facebook-unity-sdk-xxx.unitypackage the file
  3. 3.
    Open downloaded package
  4. 4.
    Click Import
  5. 5.
    Create your app in Facebook developer account https://developers.facebook.com/apps/ Add a New App
  6. 6.
    Select Gaming app type and enter the app name
  7. 7.
    Select Settings->Basic and select category Games and Sub-category and Save changes
  8. 8.
    Now we got App ID. Lets put App ID and App name into Unity. Go to menu Facebook->Edit settings
  9. 9.
    Put your App ID and App name into setting in Inspector
Make sure you have no spaces!
  1. 10.
    Regenerate android manifest
  2. 11.
    Click Settings and + Add Platform
  3. 12.
    Select your platform. Note: This asset adjusted for mobile platforms, to use Facebook canvas you should make changes like landscape view and Facebook monetization.
  4. 13.
    For Android: Set your package name Set class name: com.facebook.unity.FBUnityDeepLinkingActivity Enable Single Sign On Enable Deep Linking
  5. 14.
    For iOS: For Bundle ID use Apple ID from the Appstore connect For iPhone and iPad store ID use your package name Enable Single Sign On Enable Deep Linking
  6. 15.
    Put Key Hashes from Unity Facebook Settings
  1. 16.
    Save changes
  1. 17.
    In Settings -> Advanced set is as Native app.
  1. 18.
    Make it public to make it works.
  1. 19.
    How to fill Privacy policy - GUIDE
  2. 20.
    Go to Dashboard, and setup the Facebook Login
  3. 21.
    Select a platform and go to the settings of the Facebook login
  4. 22.
    Keep it by default like this
  5. 23.
    Don’t forget to Save all Changes
  6. 24.
    Go to the Dashboard, find the App Center and click “Set up”
  7. 25.
    Fill the screenshots and the description of your game. This information will represent your game in Facebook.
  8. 26.
    Generate the key-hash for Android. More info
  9. 27.
    Adding User friends permission. Before sending a requiest test Facebook login on the android device. In case of issues check the Troubleshooting For proper work of the leadboards you should have all these permissions 1)Go to the Permissions and features
    2)Find the user_friends permission and press “Request” and “Continue” d) Fill the form and provide verification details In the “Tell us Fill the text area with the next text:
1. Open the game
2. Click Play
3. On the map click to the Facebook icon and login
4. Click on the level on the map to see leadboard of you and your friends if they pass a level
e) Upload the video, we prepared file for you Download video
f) Click Save
  1. 28.
    Then complete App Verification and Submit for Review.
Leadboard, friends and player cloud store setup
Next service provide leadboard, friends on map, player data cloud store, just choose one: how to setup PlayFab (Paid service)

Troubleshooting

  1. 1.
    The error on the device: “Invalid key hash”. Put the key hash from the error to your Facebook settings.
  2. 2.
    Main reason of the review rejection.
    Generate the key-hash If it doesn’t help try to: create test app in the Facebook account, use new Facebook ID in Unity, Launch the game on android device, Get the error about the wrong key hash Then put this new key hash into Facebook settings
  3. 3.
    "Assets\GameSparks\GameSparksSettings.cs(6,16): error CS1029: #error: 'The GameSparks SDK only supports "Scripting Runtime Version.NET 3.5 Equivalent" and Api compatibility level 2.0'" - the error related to latest gamesparks To solve please import this package
  4. 4.
    Android building problem Try this Android Resolver
  5. 5.
    Keytool not found. How to fix
  6. 6.
    Release 7.12.1 has problem on iOS, recommend to use 7.12.0 instead
  7. 7.
    Don’t try to use fake accounts to test, use test spectial test account inside of the game
  8. 8.
    NullReferenceException: Object reference not set to an instance of an object; GameSparks.Platforms.PlatformBase.Start () (at Assets/GameSparks/Platforms/PlatformBase.cs:209) Gamesparks from 5.5.6 require to add GameSparksUnity component to the NetworkManager object in the map or game scene depending from the game
  9. 9.
    error CS1704: An assembly with the same name `Facebook.Unity.Settings' has already been imported. Solution: delete Facebook.Unity.Settings.dll file from <Your Project>/Library/FacebookSDK/ and restart Unity
  10. 10.
    IOS building error: FBSDKShareKit/FBSDKShareKit.h file not found Solution: Check path to facebook sdk plugin. Like this
  11. 11.
    Unity 5.5 and Facebook SDK not working well together in iOS Try to use latest Unity patch Unity 5.5 patches they should fix it someday. Or read this http://answers.unity3d.com/questions/1252223/unity-55-and-facebook-sdk-not-working-well-togethe.html
  12. 12.
    If you still can’t see the leaboard try to delete game from Gamesparks account and create in again from the Unity.
  13. 13.
Open AndroidManifest file from Assets/Plugins/Android and add next line xmlns:tools="http://schemas.android.com/tools" there
Last modified 4mo ago