Get started with Crashlytics for Unity

Select platform:iOS+AndroidAndroid NDKFlutterUnity


This guide describes how to get started withFirebase Crashlytics inyour Unity project.

After you've set up theFirebase Crashlytics SDK in your app, you can getcomprehensive crash reports in theFirebase console.

Setting upCrashlytics requires tasks both in theFirebase console andyour IDE (like adding a Firebase configuration file and theCrashlyticsSDK). To finish setup, you'll need to force a test crash to send your firstcrash report to Firebase.

Before you begin

  1. If you haven't already,add Firebaseto your Unity project. If you don't have a Unity project, you can download asample app.

  2. Recommended: To automatically getbreadcrumb logsto understand user actions leading up to a crash, non-fatal, or ANR event,you need to enableGoogle Analytics in your Firebase project.

    • If your existing Firebase project doesn't haveGoogle Analyticsenabled, you can enableGoogle Analytics from theIntegrations tab of your >Project settingsin theFirebase console.

    • If you're creating a new Firebase project, enableGoogle Analyticsduring the project creation workflow.

Step 1: Add theCrashlytics SDK to your app

Note that when you registered your Unity project with your Firebase project, youmight have already downloaded theFirebaseUnity SDK and added the packagesdescribed in the following steps.

  1. Download theFirebaseUnity SDK, then unzip the SDK somewhere convenient.TheFirebaseUnity SDK is not platform-specific.

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

  3. From the unzipped SDK, select to import theCrashlytics SDK(FirebaseCrashlytics.unitypackage).

    To take advantage ofbreadcrumb logsalso add the Firebase SDK forGoogle Analytics to your app(FirebaseAnalytics.unitypackage). Make sure thatGoogle Analytics is enabled in your Firebase project.

    Unity 2017.x and later allow the use of the .NET 4.x framework. If your Unity project uses .NET 4.x, importdotnet4/FirebaseCrashlytics.unitypackage.

  4. In theImport Unity Package window, clickImport.

Important: With theFirebaseUnity SDK for Apple platforms,do not disablemethod swizzling. Swizzling is required by the SDK; without it, key Firebasefeatures (such asFCM token handling) do not function properly.

Step 2: InitializeCrashlytics

  1. Create a new C# script, then add it to aGameObject in the scene.

    1. Open your first scene, then create an emptyGameObject namedCrashlyticsInitializer.

    2. ClickAdd Component in theInspector for the new object.

    3. Select yourCrashlyticsInit script to add it to theCrashlyticsInitializer object.

  2. InitializeCrashlytics in the script'sStart method:

    usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;// Import Firebase and CrashlyticsusingFirebase;usingFirebase.Crashlytics;publicclassCrashlyticsInit:MonoBehaviour{// Use this for initializationvoidStart(){// Initialize FirebaseFirebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task=>{vardependencyStatus=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.//Crashlytics will use the DefaultInstance, as well;// this ensures thatCrashlytics is initialized.Firebase.FirebaseAppapp=Firebase.FirebaseApp.DefaultInstance;// When this property is set to true, Crashlytics will report all// uncaught exceptions as fatal events. This is the recommended behavior.Crashlytics.ReportUncaughtExceptionsAsFatal=true;// Set a flag here for indicating that your project is ready to use Firebase.}else{UnityEngine.Debug.LogError(System.String.Format("Could not resolve all Firebase dependencies: {0}",dependencyStatus));//FirebaseUnity SDK is not safe to use here.}});}// Update is called once per framevoidUpdate()// ...}

Step 3:(Android only) Get set up for symbol uploading

This step is only required for Android apps that use IL2CPP.

  • For Android apps that use Unity's Mono scripting backend, these steps aren'tneeded.

  • For Apple platform apps, these steps aren't needed because the Firebase UnityEditor plugin automatically configures your Xcode project to upload symbols.

Crashlytics’s Unity SDK 8.6.1+ automatically includes NDK crash reporting,which allowsCrashlytics to automatically report UnityIL2CPP crashes on Android. However, to see symbolicated stack traces for native librarycrashes in theCrashlytics dashboard, you must upload symbol information atbuild time using theFirebase CLI.

To get set up for symbol uploading, follow the instructions toinstall theFirebase CLI.

If you've already installed the CLI, make sure toupdate to its latest version.

Note: You can also runFirebase CLI commands inCloud Shell.Cloud Shell is abrowser-based, pre-authenticated command-line environment, accessible from theFirebase console,and comes with theFirebase CLI pre-installed. This makes it a convenient option for gettingstarted quickly, provided you add your project files to theCloud Shell environment.

Step 4: Build your project and upload symbols

Note: Complete the steps in this section to get started withCrashlytics.Then, in the future, complete these steps each time that you create a releasebuild or any build for which you want to see symbolicated stack traces in theFirebase console.

iOS+ (Apple platform)

  1. From theBuild Settings dialog, export your project to an Xcode workspace.

  2. Build your app.

    For Apple platforms, the Firebase Unity Editor plugin automaticallyconfigures your Xcode project to generate and upload aCrashlytics-compatible symbol file to Firebase servers for each build.

Android

  1. From theBuild Settings dialog, do one of the following:

    • Export to an Android Studio project to build your project; or

    • Build your APK directly from the Unity Editor.
      Before building, make sure the checkbox forCreate symbols.zip ischecked in theBuild Settings dialog.

  2. Once your build has finished, generate aCrashlytics-compatible symbolfile and upload it to Firebase servers by running the followingFirebase CLI command:

    firebase crashlytics:symbols:upload --app=FIREBASE_APP_IDPATH/TO/SYMBOLS

Step 5: Force a test crash to finish setup

To finish setting upCrashlytics and see initial data in theCrashlytics dashboard of theFirebase console, you need to force a testcrash.

  1. Find an existingGameObject, then add to it the following script. Thisscript will cause a test crash a few seconds after you run your app.

    usingSystem;usingUnityEngine;publicclassCrashlyticsTester:MonoBehaviour{intupdatesBeforeException;// Use this for initializationvoidStart(){updatesBeforeException=0;}// Update is called once per framevoidUpdate(){// Call the exception-throwing method here so that it's run// every frame updatethrowExceptionEvery60Updates();}// A method that tests yourCrashlytics implementation by throwing an// exception every 60 frame updates. You should see reports in the//Firebase console a few minutes after running your app with this method.voidthrowExceptionEvery60Updates(){if(updatesBeforeException>0){updatesBeforeException--;}else{// Set the counter to 60 updatesupdatesBeforeException=60;// Throw an exception to test yourCrashlytics implementationthrownewSystem.Exception("test exception please ignore");}}}
  2. Build your app and upload symbol information after your build finishes.

  3. Run your app. Once your app is running, watch the device log and wait forthe exception to trigger from theCrashlyticsTester.

  4. Go to theCrashlytics dashboard of theFirebase console to see your test crash.

    If you've refreshed the console and you're still not seeing the test crashafter five minutes,enable debug loggingto see if your app is sending crash reports.


And that's it!Crashlytics is now monitoring your app for crashes.Visit theCrashlytics dashboard to view and investigateall your reports and statistics.

Next steps

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

Last updated 2026-02-18 UTC.