guntercn / Facebook-Unity-Fix

Fixes a common problem with the Facebook Unity SDK when reading the keystore file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facebook-Unity-Fix - Now Version 6.2.1

##Update - 2015/02/23 ## Now updated to version 6.2.1 from 6.1. The 6.2.1, 6.0 and 5.1 packages are still avaiable for people who would prefer being on the older version of the Facebook Unity SDK.

##Description## The Facebook SDK makes the assumtion that the keystore file you are going to use is the .android/debug.keystore file when in reality unity uses the keystore the user selects in the Publish Settings under android. I have gone through and edited two of the SDK Files in order to provide easy functionality to allow users to quickly get the actual keystore value that facebook uses when published to an Android phone. Now you get a real message that asks you to setup your keystore file in the android publish menu under your build settings, and I have created a refresh button that allows you to check your keystore value in the Facebook Settings GUI.

This is a copy of the Facebook Unity SDK 6.0 which you can get the original source here. https://developers.facebook.com/docs/unity/downloads/?campaign_id=282184128580929&placement=SDK_list

Adding the fix so that facebook GUI displays the key that it actually uses on the Android device instead of the default .android\debug.keystore file. Changes are as follows...

##Instructions## To use either zip, clone, or grab the FacebookSDK5.6.0-Fix.unitypackage file and extract into the assets folder in your unity project.

Once it's setup, go into your publish settings for android, and create a keystore file with a debug or release key. Make sure you define the keystore password and alias passwords otherwise the "Debug Android Key Hash" will be incorrect. Now go into the Facebook Settings (located in the top menu) and press the refresh button in the inspector. You should see the correct key appear in the "Debug Android Key Hash".

##Code Modifications From base Facebook SDK 6.0##

####Changes for FacebookAndroidUtils.cs####

  • Removed static string debugKeyHash (not always debug key)
  • Created static string playerSettingKeyHash
  • Updated GetKeyHash method to support a fourth parameter that being the key alias password as it may not always be the same as the actual password for the file.
  • Updated call in DebugKeyHash that called GetKeyHash to now use PlayerSettings.Android.keyaliasName, PlayerSettings.Android.keyaliasPass, and PlayerSettings.Android.keystorePass.
  • Removed method DebugKeyStorePath as its now useless as it was never being used in the first place.
  • Updated HasAndroidKeystoreFile() method to check PlayerSettings.Android.keystoreName instead of DebugKeyStorePath.
  • Added method refresh() to allow the user to check the key again without having to restart or delete the reference file.

####Changes for FacebookSettingsEditor.cs####

  • Updated class AndroidUtilsGUI() to now display the message "Your keystore file is missing! You can create one by going into Unity's Build Settings->Android->Publish Settings." whenever the keystore file is missing.
  • Added a refresh button that calls the FacebookAndroidUtils refresh method.

Hope these changes help anyone that's using the Facebook SDK for Unity3d!

NOTE: This project is not owned by me in any way. I have just put up a small fix to allow developers easy access to the real keystore value.

About

Fixes a common problem with the Facebook Unity SDK when reading the keystore file.


Languages

Language:Java 74.1%Language:Objective-C 17.8%Language:C# 6.0%Language:Objective-C++ 1.3%Language:Makefile 0.8%