Coding Guidelines

The Facebook API is implemented using Unity Official Facebook SDK

What does it mean?

First of all Unity Facebook SDK will be imported in your project with the plugin. And most of facebook plugin functionality is a wrapper around Unity Facebook implementation.

It also mean that Unity Facebook SDK integrated with the plugin and has no conflicts, which makes you able to use it (if for some reason you do not like the way facebook stuff is implemented in this plugin). Or use function from Unity Facebook SDK. Like, for example, direct API call using FB.AP function.

And of course all other stuff offered by Unity SDK is available for you.


What the difference between Unity SDK and Mobile Social Plugin?

There is couple difference:

  • Another workflow.
  • Few extra features based on Unity SDK  like for example:
    • Posting screenshot in the the background
    • Posting with auto authentication check
  • Few feature not available from  Unity SDK like for example:
    • Platform Native Image Posting
    • Platform Native Text Posting
    • Scores API
    • Likes API
  • Ability to use PlayMaker Actions instead coding.
  • And all other feature you got with the plugin instead Facebook.

There are two general ways you can go with Facebook integration. Pretty much same as Twitter

1) If you want to implement only posting, and you do not need to know if a user posted the message or cancelled the posting sequence.  

In this case you can use native platform API.


  • You do not need to create your Facebook app
  • You do not need to prompt user to authenticate with your app with requested permissions before you can use Facebook API
  • User will not leave your app for Facebook authentication.
  • Posting looks natively to platform


  • You can only prompt user to post messages / images to facebook.
  • You will not know or be able to respond if the user cancels their post from the facebook app
  • You will not able to post text on Android, due to facebook restrictions.

Note:  On Android platform posting text may be ignored via Facebook application, due to Facebook policy (they want people to share own thoughts, not the pre-defined text by developer). 

If you decide to go this way, you may use the following API calls from anywhere in your project to prompt the user to tweet a message or image, using Facebook’s UI:

SPShareUtility.FacebookShare("This is my text to share");
SPShareUtility.FacebookShare("This is my text to share", ImageToShare);


Result of this API calls would be similar to screenshot below:


You may read more about native shared behavior on different platforms at this section.

2)  If you need a lot more, and you want to use all plugin power.


  • You will be able  use all feature offered by the plugin
  • More permissions from the user
  • Full control of user actions


  • You have to create app on facebook.
  • Extra work with rendering message windows, since we are calling API directly


If you decide to go this way. Then you need to complete Setup Steps before you begin to use Facebook API.

I would recommend creating singleton class which will be responsible for all your game Facebook interactions.