Learn how to integrate Firebase with Unity using a step-by-step guide covering installation, app registration, SDK import, platform setup, and testing.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
Step 1: Install Unity and Create a New Project
Step 2: Register Your App with Firebase
google-services.json (for Android) or GoogleService-Info.plist (for iOS) configuration file when prompted.
Step 3: Import Firebase SDK
Firebase Unity SDK package.Assets > Import Package > Custom Package.
Step 4: Set Up Android Configuration
google-services.json file you downloaded into the Assets folder of your Unity project.File > Build Settings, select Android and click Switch Platform.Edit > Project Settings.
Step 5: Set Up iOS Configuration
GoogleService-Info.plist file into the Assets folder of your Unity project.File > Build Settings, select iOS and click Switch Platform.
Step 6: Initialize Firebase in Unity
Inside a C# script (e.g., FirebaseInitializer.cs), initialize Firebase:
using UnityEngine;
using Firebase;
using Firebase.Extensions;
public class FirebaseInitializer : MonoBehaviour
{
void Start()
{
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
{
FirebaseApp app = FirebaseApp.DefaultInstance;
// Your Firebase code and initialization logic here
Debug.Log("Firebase Initialized");
});
}
}
Step 7: Test Your Firebase Setup
Play in the Unity Editor to ensure the Firebase initialization code runs without errors.
Step 8: Integrate Firebase Features
Decide which Firebase services you need, such as Auth, Database, Firestore, or Analytics, and follow their specific integration guidelines.
For example, to integrate Firebase Authentication, you can modify your script as follows:
using Firebase.Auth;
...
FirebaseAuth auth = FirebaseAuth.DefaultInstance;
void LoginUser(string email, string password)
{
auth.SignInWithEmailAndPasswordAsync(email, password).ContinueWithOnMainThread(task =>
{
if (task.IsCanceled || task.IsFaulted)
{
Debug.LogError("SignInWithEmailAndPasswordAsync encountered an error: " + task.Exception);
return;
}
FirebaseUser newUser = task.Result;
Debug.LogFormat("User signed in successfully: {0} ({1})",
newUser.DisplayName, newUser.UserId);
});
}
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.