[ Web Proxy ]
URL:
Viewing: https://firebase.google.com/docs/unity/setup [Back]  [Original]

Add Firebase to your Unity project  |  Firebase for Unity Skip to main content
Overview Fundamentals AI Build Run Reference Samples
Firebase [Firebase]
Send feedback

Add Firebase to your Unity project Stay organized with collections Save and categorize content based on your preferences.

Power up your Unity games with our Firebase Unity SDKs.

To show how easy it is to plug Firebase into your Unity project, we made a sample game, MechaHamster. If you want to try out adding Firebase to a game, use the starter version that's on GitHub. If you want a completed version, check out the versions in the App Store or the Google Play Store.

MechaHamster (GitHub)

MechaHamster (App Store)

MechaHamster (Play Store)


Find out more information about powering up your games with Firebase at our Firebase games page.

Learn which Firebase products the Firebase Unity SDK supports.

Already added Firebase to your Unity project? Make sure that you're using the latest version of the Firebase Unity SDK.

Prerequisites

If you don't already have a Unity project and just want to try out a Firebase product, you can download one of our quickstart samples.

Step 1: Create a Firebase project

Before you can add Firebase to your Unity project, you need to create a Firebase project to connect to your Unity project. Visit Understand Firebase Projects to learn more about Firebase projects.

View instructions to create a Firebase project

New to Firebase or Cloud

Follow these steps if you're new to Firebase or Google Cloud.
You can also follow these steps if you want to create a wholly new Firebase project (and its underlying Google Cloud project).

  1. Sign into the Firebase console.
  2. Click the button to create a new Firebase project.
  3. In the text field, enter a project name.

    If you're part of a Google Cloud org, you can optionally select which folder you create your project in.

    Your project name is used as a display name in Firebase interfaces, and Firebase auto-creates a unique project ID based on this project name. Note that you can optionally click the Edit icon now to set your preferred project ID, but you cannot change this ID after project creation. Learn about how Firebase uses the project ID.
  4. If prompted, review and accept the Firebase terms, then click Continue.
  5. (Optional) Enable AI assistance in the Firebase console (called "Gemini in Firebase"), which can help you get started and streamline your development process.
  6. (Optional) Set up Google Analytics for your project, which enables an optimal experience using these Firebase products: Firebase A/B Testing, Cloud Messaging, Crashlytics, In-App Messaging, and Remote Config (including Personalization).

    Either select an existing Google Analytics account or create a new account. If you create a new account, select your Analytics reporting location, then accept the data sharing settings and Google Analytics terms for your project.

    You can always set up Google Analytics later in the Integrations tab of your Project settings.
  7. Click Create project.

Firebase creates your project, provisions some initial resources, and enables important APIs. When the process completes, you'll be taken to the overview page for your Firebase project in the Firebase console.

Existing Cloud project

Follow these steps if you want to start using Firebase with an existing Google Cloud project. Learn more about and troubleshoot "adding Firebase" to an existing Google Cloud project.

  1. Sign into the Firebase console with the account that gives you access to the existing Google Cloud project.
  2. Click the button to create a new Firebase project.
  3. At the bottom of the page, click Add Firebase to Google Cloud project.
  4. In the text field, start entering the project name of the existing project, and then select the project from the displayed list.
  5. Click Open project.
  6. If prompted, review and accept the Firebase terms, then click Continue.
  7. (Optional) Enable AI assistance in the Firebase console (called "Gemini in Firebase"), which can help you get started and streamline your development process.
  8. (Optional) Set up Google Analytics for your project, which enables an optimal experience using these Firebase products: Firebase A/B Testing, Cloud Messaging, Crashlytics, In-App Messaging, and Remote Config (including Personalization).

    Either select an existing Google Analytics account or create a new account. If you create a new account, select your Analytics reporting location, then accept the data sharing settings and Google Analytics terms for your project.

    You can always set up Google Analytics later in the Integrations tab of your Project settings.
  9. Click Add Firebase.

Firebase adds Firebase to your existing project. When the process completes, you'll be taken to the overview page for your Firebase project in the Firebase console.

Step 2: Register your app with Firebase

You can register one or more apps or games to connect with your Firebase project.

If you're releasing your game on both iOS and Android, register both build targets of your Unity project with the same Firebase project. If you have multiple build variants with different iOS bundle IDs or Android app IDs defined, you must register each variant with the same Firebase project.
  1. Go to the Firebase console.

  2. In the center of the project overview page, click the Unity icon () to launch the setup workflow.

    If you've already added an app to your Firebase project, click Add app to display the platform options.

  3. Select which build target of your Unity project that youd like to register, or you can even select to register both targets now at the same time.

    Note: If you only register one build target of your Unity project now, you can always return to the setup workflow later to register the other build target.
  4. Enter your Unity projects platform-specific ID(s).

    • For iOS Enter your Unity projects iOS ID in the iOS bundle ID field.

    • For Android Enter your Unity projects Android ID in the Android package name field.
      The terms package name and application ID are often used interchangeably.

    Where do you find your Unity project's ID?

    Open your Unity project in your Unity IDE, then navigate to the settings section for each platform:

    • For iOS Navigate to Build Settings > iOS.

    • For Android Navigate to Android > Player Settings > Other Settings.

    Your Unity project's ID is the Bundle Identifier value (example ID: com.yourcompany.yourproject).

    Make sure that you enter the ID that your project is actually using. The ID value is case-sensitive, and it cannot be changed for these Firebase apps after they're registered with your Firebase project.
  5. (Optional) Enter your Unity projects platform-specific nickname(s).
    These nicknames are internal, convenience identifiers and are only visible to you in the Firebase console.

  6. Click Register app.

Step 3: Add Firebase configuration files

  1. Obtain your platform-specific Firebase configuration file(s) in the Firebase console setup workflow.

    If you're registering both an iOS and an Android build target of your Unity project, you'll need to download and add the config files for both platforms.
    • For iOS Click Download GoogleService-Info.plist.

    • For Android Click Download google-services.json.

    What do you need to know about this config file?

    • The Firebase config file contains unique, but non-secret identifiers for your project and app. To learn more about this config file, visit Understand Firebase Projects.

    • You can download your Firebase config file again at any time.

    • Make sure the config file name is not appended with additional characters, like (2).

  2. Open the Project window of your Unity project, then move your config file(s) into the Assets folder.

  3. Back in the Firebase console, in the setup workflow, click Next.

Step 4: Add Firebase Unity SDKs

Note: The following setup workflow is recommended for first time users of the Unity SDK. For particular use cases, Firebase offers alternative setup flows.
  1. In the Firebase console, click Download Firebase Unity SDK, then unzip the SDK somewhere convenient.

    • You can download the Firebase Unity SDK again at any time.

    • The Firebase Unity SDK is not platform-specific.

  2. In your open Unity project, navigate to Assets > Import Package > Custom Package.

  3. From the unzipped SDK, select the supported Firebase products that you want to use in your app.

    Analytics enabled

    • Add the Firebase package for Google Analytics: FirebaseAnalytics.unitypackage
    • Add the packages for any other Firebase products you want to use in your app. For example, to use Firebase Authentication and Firebase Realtime Database:
      FirebaseAuth.unitypackage and FirebaseDatabase.unitypackage

    Analytics not enabled

    Add the packages for the Firebase products you want to use in your app. For example, to use Firebase Authentication and Firebase Realtime Database:
    FirebaseAuth.unitypackage and FirebaseDatabase.unitypackage

  4. In the Import Unity Package window, click Import.

  5. Back in the Firebase console, in the setup workflow, click Next.

Important: With the Firebase Unity SDK for iOS, do not disable method swizzling. Swizzling is required by the SDK; without it, key Firebase features (such as FCM token handling) do not function properly.

Step 5: Confirm Google Play services version requirements

Some products in the Firebase Unity SDK for Android require Google Play services. Learn which products have this dependency. Google Play services must be up-to-date before those products can be used.

Add the following using statement and initialization code at the start of your application. You can check for and optionally update Google Play services to the required version before calling any other methods in the SDK.

using Firebase.Extensions;
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => {
  var dependencyStatus = task.Result;
  if (dependencyStatus == Firebase.DependencyStatus.Available) {
    // Create and hold a reference to your FirebaseApp,
    // where app is a Firebase.FirebaseApp property of your application class.
       app = Firebase.FirebaseApp.DefaultInstance;

    // Set a flag here to indicate whether Firebase is ready to use by your app.
  } else {
    UnityEngine.Debug.LogError(System.String.Format(
      "Could not resolve all Firebase dependencies: {0}", dependencyStatus));
    // Firebase Unity SDK is not safe to use here.
  }
});

Youre all set! Your Unity project is registered and configured to use Firebase.

If you're having trouble getting set up, though, visit the Unity troubleshooting & FAQ.

Set up a desktop workflow (beta)

Caution: Firebase Unity SDK desktop support is a beta feature. This feature is intended only for workflows during the development of your game, not for publicly shipping code.

When you're creating a game, it's often much easier to test your game in the Unity editor and on desktop platforms first, then deploy and test on mobile devices later in development. To support this workflow, we provide a subset of the Firebase Unity SDKs which can run on Windows, macOS, Linux, and from within the Unity editor.

  1. Set up a desktop-platform Unity project by following the same instructions as for a mobile platform (start with the Register your app with Firebase step above).

  2. Run your Unity project in the Unity IDE or select to build your Unity project for desktop.

    Note: Firebase locates your mobile Firebase config file (either GoogleService-Info.plist or google-services.json) that you added to your Unity project. Then, from the mobile config file, Firebase automatically generates a desktop Firebase config file (google-services-desktop.json). This desktop config file contains the Unity project ID that you entered in the Firebase console setup workflow. This file associates your app with your Firebase project.

    If the editor cannot locate the desktop config file, check that the StreamingAssets directory exists and that the desktop config file is inside of it.
  3. (Optional) Run your Unity project in Edit Mode.

    The Firebase Unity SDK can also be run in Unity's edit mode, allowing its use in editor plugins.

    1. When you create a FirebaseApp used by the editor, don't use the default instance.

    2. Instead, provide a unique name to the FirebaseApp.Create() call.

      This is important to avoid a conflict in options between the instance used by the Unity IDE and the instance used by your Unity project.

Supported Firebase products

Learn more about the Unity Firebase libraries in the reference documentation.

Available Firebase libraries for mobile

The Firebase Unity SDK supports the following Firebase products on Apple and Android:

Note: For Apple platforms, each Firebase library may only support a selection of Apple OS platforms (iOS, tvOS, etc.). Check which platforms are supported by each library in Learn more about Unity and Firebase.
Firebase product Unity package
AdMob Distributed separately in the AdMob Unity Plugin
Firebase AI Logic FirebaseAI.unitypackage
Analytics FirebaseAnalytics.unitypackage
App Check FirebaseAppCheck.unitypackage
Authentication FirebaseAuth.unitypackage
Cloud Firestore FirebaseFirestore.unitypackage
Cloud Functions FirebaseFunctions.unitypackage
Cloud Messaging FirebaseMessaging.unitypackage
(recommended) FirebaseAnalytics.unitypackage
Cloud Storage FirebaseStorage.unitypackage
Crashlytics FirebaseCrashlytics.unitypackage
(recommended) FirebaseAnalytics.unitypackage
Realtime Database FirebaseDatabase.unitypackage
Remote Config FirebaseRemoteConfig.unitypackage
(recommended) FirebaseAnalytics.unitypackage
DEPRECATED OR UNSUPPORTED LIBRARIES
Dynamic Links FirebaseDynamicLinks.unitypackage
(recommended) FirebaseAnalytics.unitypackage

Available Firebase libraries for desktop

The Firebase Unity SDK includes desktop workflow support for a subset of products, enabling certain parts of Firebase to be used in the Unity editor and in standalone desktop builds on Windows, macOS, and Linux.

Caution: Firebase Unity SDK desktop support is a beta feature. This feature is intended only for workflows during the development of your game, not for publicly shipping code.
Firebase product (desktop) Unity package
Firebase AI Logic FirebaseAI.unitypackage
App Check FirebaseAppCheck.unitypackage
Authentication FirebaseAuth.unitypackage
Cloud Functions FirebaseFunctions.unitypackage
Cloud Firestore FirebaseFirestore.unitypackage
Cloud Storage FirebaseStorage.unitypackage
Realtime Database FirebaseDatabase.unitypackage
Remote Config FirebaseRemoteConfig.unitypackage

Firebase provides the remaining desktop libraries as stub (non-functional) implementations for convenience when building for Windows, macOS, and Linux. Therefore, you don't need to conditionally compile code to target the desktop.

Next steps

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-19 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-19 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page