Overview
The Firebase Unity SDK provides a selection of packages that enable the use of Firebase features in the Unity game engine.
The following features are supported by the Firebase Unity SDK on iOS and Android:
Setup for iOS
Prerequisites
- Unity 5.3 or later.
- Xcode 7.0 or later.
- For Cloud Messaging:
- A physical iOS device
- APNs certificate with Push Notifications enabled
- CocoaPods 1.0.0 or later.
- A Unity project bundle identifier.
If you don't have a Unity project already, you can download one of our quickstart samples if you just want to try a Firebase feature. If you're using a quickstart, remember to get the bundle identifier from the project settings, you'll need it for the next step.
Add Firebase to your app
It's time to add Firebase to your app. To do this you'll need a Firebase project and a Firebase configuration file for your app.
- Create a Firebase project in the Firebase console, if you don't already have one. If you already have an existing Google project associated with your mobile app, click Import Google Project. Otherwise, click Create New Project.
- Click Add Firebase to your iOS app and follow the setup steps. If you're importing an existing Google project, this may happen automatically and you can just download the config file.
- When prompted, enter your app's bundle ID. It's important to enter the bundle ID your app is using; this can only be set when you add an app to your Firebase project.
- At the end, you'll download a
GoogleService-Info.plistfile. You can download this file again at any time.
Add the SDK to your app
- If you don't have a Unity project yet, create one now. You can also use one of the quickstart samples to try out a Firebase feature.
- Download the Firebase Unity SDK and unzip it somewhere convenient.
-
Open your Unity project in the Unity editor.
- Select the
File > Open Projectmenu item. - Click
Open. - Navigate to the app directory in the file dialog and click
Open.
- Select the
-
Import the Firebase feature plugin, for example
Firebase Analytics.- Select the
Assets > Import Package > Custom Packagemenu item. - Import
FirebaseAnalytics.unitypackagefrom the Firebase Unity SDK, downloaded previously. - Click the
Importwhen theImport Unity Packagewindow appears.
- Select the
-
Add the
GoogleService-Info.plistfile to the project.- Drag the
GoogleService-Info.plistdownloaded from the Firebase console into any folder in the Unity project.
- Drag the
-
Build for iOS
- Select the
File > Build Settingsmenu option. - Select
iOSin thePlatformlist. - Click
Switch Platformto selectiOSas the target platform. - Wait for the spinner (compiling) icon to stop in the bottom right corner of the Unity status bar.
- Click
Build and Run.
- Select the
Setup for Android
- Unity 5.3 or higher.
- A device running Android 2.3 (Gingerbread) or newer.
- A Unity project bundle identifier.
If you don't have a Unity project already, you can download one of our quickstart samples if you just want to try a Firebase feature. If you're using a quickstart, remember to get the bundle identifier from the project settings, you'll need it for the next step.
Add Firebase to Your app
To add Firebase to your app you'll need a Firebase project and a Firebase configuration file for your app.
- Create a Firebase project in the Firebase console, if you don't already have one. If you already have an existing Google project associated with your mobile app, click Import Google Project. Otherwise, click Create New Project.
- Click Add Firebase to your Android app and follow the setup steps. If you're importing an existing Google project, this may happen automatically and you can just download the config file.
- When prompted, enter your app's package name. It's important to enter the package name your app is using; this can only be set when you add an app to your Firebase project.
- At the end, you'll download a
google-services.jsonfile. You can download this file again at any time.
Add the SDK to your app
- If you don't have a Unity project yet, create one now. You can also use one of the quickstart samples to try out a Firebase feature.
- Download the Firebase Unity SDK and unzip it somewhere convenient.
-
Open your Unity project in the Unity editor.
- Select the
File > Open Projectmenu item. - Click
Open. - Navigate to the app directory in the file dialog and click
Open.
- Select the
-
Import the Firebase feature plugin, for example
Firebase Analytics- Select the
Assets > Import Package > Custom Packagemenu item. - Import
FirebaseAnalytics.unitypackagefrom the Firebase Unity SDK, downloaded previously. - Click the
Importwhen theImport Unity Packagewindow appears.
- Select the
-
Add the
google-services.jsonfile to the project.- Drag the
google-services.jsondownloaded from the Firebase console into any folder in your project.
- Drag the
-
Build for Android
- Select the
File > Build Settingsmenu option. - Select
Androidin thePlatformlist. - Click
Switch Platformto selectAndroidas the target platform. - Wait for the spinner (compiling) icon to stop in the bottom right corner of the Unity status bar.
- Click
Build and Run.
- Select the
Stub Implementations for the Editor
Stub (non-functional) implementations are provided for convenience when building for Windows, OSX and Linux so that you don't need to conditionally compile code when also targeting the desktop.

