Facebook SDK for Unity
Build cross-platform games on Facebook rapidly and easily
The Unity engine and ecosystem gives developers a world class technology platform from which they can build games that work seamlessly across multiple platforms quickly and effectively.
The Facebook SDK for Unity provides a comprehensive collection of Facebook's social features, giving players of your Unity game the ability to share content with their friends and allowing you to create a personal, social gaming experience.
The Facebook SDK for Unity complements Unity's strengths, and improves the Unity and Facebook experiences in four main areas:

Simplified Cross-Platform Development

The Facebook SDK for Unity complements Unity Technologies' seamless cross-platform support, providing a pure-Unity write-once, complete-everywhere experience across the key gaming platforms of Unity Web Player, Android and iOS. By maintaing a single codebase, you'll be able to deploy socially integrated gaming experiences to your players, regardless of platform.
The Facebook SDK for Unity provides a fast, native, Facebook integration, using the exact same implementation, regardless of which environment you're deploying to. In addition to providing a base set of features that are invoked consistently across platforms, the Facebook SDK for Unity also offers support for Facebook features that are unique to a particular platform (e.g. payments on the Web). This will allow you to keep your code clean, using a simple, consistent model for everything your app can do on Facebook.

Fullscreen Dialogs

The Facebook SDK for Unity provides a better way to display Facebook dialogs, without making the game relinquish fullscreen mode, creating fast, native dialogs that work flawlessly in fullscreen mode, keeping the gamer engaged and connected.
For a non-Unity fullscreen Canvas game to open a Facebook dialog today, there are a number of involved. Typically, the game needs to pause, take a screenshot, and make that the background of the web page where it's hosted. Then it needs to relinquish fullscreen mode, hide the core game component, and invoke the Facebook dialog using the JavaScript SDK. Once someone has finished interacting with the dialog, the game must reverse these steps, regain fullscreen, and let them continue playing.
The Canvas with Unity Integration environment, coupled with new features in the Facebook SDK for Unity, radically changes this experience. Facebook has built fully native versions of key dialogs directly into Unity, allowing you to display them in fullscreen, have them render instantly and perform at full speed. This creates a less disruptive flow, keeping the player fully immersed in their gameplay experience.
Below, a game is shown using this functionality, allowing a player to invite Facebook friends via the Request Dialog:
Note: Only the Feed and Request dialogs are available in this form, and only for apps deployed to Canvas with Unity Integration. Facebook is working to integrate more dialogs in this way. In the meantime, those dialogs can be invoked via the by other means.

Easy Deployment

Games on Facebook.com have access to a vibrant and growing community of over 250 million monthly active gamers. Publishing your Unity game to Facebook is quick and easy, allowing you to reach a huge audience in just a few clicks.
To enable the deployment of your Unity title onto Facebook, we've built the Canvas with Unity Integration, a new option for your app. It's similar to existing Canvas, but simpler to configure. Typically with Canvas, you provide Facebook with your app's 'Canvas URL', a web page hosting your game that gets loaded into an iframe within the Facebook.com chrome.
When you publish to the Canvas with Unity Integration, instead, you'll only specify the URL where you're hosting the game object exported from Unity. Within your App Settings, you'll see a new 'Unity Integration Enabled' option listed under 'App on Facebook'. Here, you supply your game object's URL in the 'Unity Binary URL' field:

Driving Unity Installs

One of the initial barriers to entry when using Unity is the installation of the browser Unity Web Player plug-in. We've constructed a Facebook branded Unity Web Player installation flow, showing potential players that Unity Web Player is endorsed by Facebook, a brand they know and trust. Facebook provides social context, demonstrating the great gameplay experiences the Unity Web Player makes possible, and the friends of the player who are already onboard.
The Unity Web Player install base is growing every day, but it is not on every browser. To help encourage people to install the plugin, there is a Facebook branded install flow, customized with art from your game, designed to let you use your game's art assets to encourage people to install Unity Web Player, and to play your game.
When someone plays your Unity game on Facebook.com, we'll check if they have Unity Web Player installed. If not, then they'll see the dialog illustrated below. The dialog explains the benefits of installing the plugin and provides assurances that it can be trusted. Facebook will use the images and text you provided as part of your App Center configuration, so there's no additional work necessary to take advantage of this functionality.
Facebook also displays promotions and reminders across the site, further encouraging people to install the Unity Web Player. The image below is an example of one of these promotions, displayed prominently at the top of News Feed.
Unity installation reminder

Next Steps

Was this document helpful?