The Crashlytics for Firebase Unity Sample demonstrates the Firebase SDK for Crashlytics with the Firebase Unity SDK inside the Unity Editor.
- Unity 5.3 or higher
- Xcode 9.4.1 or higher (when developing for iOS).
- Android SDK (when developing for Android).
- Download the Firebase Unity SDK and unzip it somewhere convenient.
- Open this sample project in the Unity editor.
- If you are not on the Unity splash screen and have an Unity project opened, select the
File > Open Projectmenu item. - Click
Open. - Navigate to this sample project directory
testappin the file dialog and clickOpen. - If you see the "Opening Project in Non-Matching Editor Installation" dialog, you can ignore it. You are running a different version of Unity than what this test app was originally created with and that is most likely fine.
- If you are not on the Unity splash screen and have an Unity project opened, select the
- Open the scene
MainScene.- Navigate to
Assets/Firebase/Sample/Crashlyticsin theProjectwindow. - Double click on
MainScenefile to open.
- Navigate to
- Import the
Firebase Crashlyticsplugin.- Select the Assets > Import Package > Custom Package menu item.
- From the Firebase Unity SDK
downloaded previously, import
FirebaseCrashlytics.unitypackagefrom the directory that matches the version of Unity you use:- If your project is configured to use .NET 3.x, import the
dotnet3/FirebaseCrashlytics.unitypackagepackage. - If your project is configured to use .NET 4.x, import the
dotnet4/FirebaseCrashlytics.unitypackagepackage.
- If your project is configured to use .NET 3.x, import the
- When the Import Unity Package window appears, click the Import button.
Once you have done this, you can run the Unity Editor and test the application.
- Create a new Firebase project and Unity iOS app.
- By default, the testapp is configured with com.google.firebase.unity.crashlytics.testapp as the package name. You should use this package name when creating your project, or update the testapp bundle identifier as described in
Optional: Update the Project Bundle Identifierbelow. - Download the
GoogleService-Info.plistfile associated with your Firebase project from the console.- For further details please refer to the general instructions which describes how to configure a Firebase application for iOS.
- By default, the testapp is configured with com.google.firebase.unity.crashlytics.testapp as the package name. You should use this package name when creating your project, or update the testapp bundle identifier as described in
- Add the
GoogleService-Info.plistfile to the project.- Navigate to the
Assets/Firebase/Sample/Crashlyticsfolder in theProjectwindow. - Drag the
GoogleService-Info.plistdownloaded from the Firebase console into the folder.- NOTE:
GoogleService-Info.plistcan be placed anywhere under theAssetsfolder.
- NOTE:
- Navigate to the
- Set up Crashlytics
- In the Firebase console -> Select your project -> Select Crashlytics -> Setup Crashlytics -> Select app is new. (You do not need to download the SDK again as you have already downloaded the Unity plugin)
- Optional: Update the Project Bundle Identifier
- If you did not use
com.google.firebase.unity.crashlytics.testappas the project package name you will need to update the sample's Bundle Identifier.- Select the
File > Build Settingsmenu option. - Select
iOSin thePlatformlist. - Click
Player Settings - In the
Player Settingspanel scroll down toBundle Identifierand update the value to the package name you provided when you registered your app with Firebase.
- Select the
- If you did not use
- 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
- Create a new Firebase project and Unity Android app.
- By default, the testapp is configured with com.google.firebase.unity.crashlytics.testapp as the package name. You should use this package name when creating your project, or update the testapp bundle identifier as described in
Optional: Update the Project Bundle Identifierbelow. - Download the
google-services.jsonfile associated with your Firebase project from the console.- For further details please refer to the general instructions which describes how to configure a Firebase application for Android.
- By default, the testapp is configured with com.google.firebase.unity.crashlytics.testapp as the package name. You should use this package name when creating your project, or update the testapp bundle identifier as described in
- Add the
google-services.jsonfile to the project.- Navigate to the
Assets/Firebase/Sample/Crashlyticsfolder in theProjectwindow. - Drag the
google-services.jsondownloaded from the Firebase console into the folder.- NOTE:
google-services.jsoncan be placed anywhere under theAssetsfolder.
- NOTE:
- Navigate to the
- Set up Crashlytics
- In the Firebase console -> Select your project -> Select Crashlytics -> Setup Crashlytics -> Select app is new. (You do not need to download the SDK again as you have already downloaded the Unity plugin)
- Optional: Update the Project Bundle Identifier
- If you did not use
com.google.firebase.unity.crashlytics.testappas the project package name you will need to update the sample's Bundle Identifier.- Select the
File > Build Settingsmenu option. - Select
Androidin thePlatformlist. - Click
Player Settings - In the
Player Settingspanel scroll down toBundle Identifierand update the value to the package name you provided when you registered your app with Firebase.
- Select the
- If you did not use
- 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
- Once the Unity test app is running (detach debugger if attached), click the
Perform All Actionsbutton - Trigger upload by completely closing and relaunching the test app
- To view the reported issues, go to the Firebase Crashlytics console for the test app:
- Add a time filter to more easily identify the errors if needed
https://firebase.google.com/support/
Copyright 2018 Google, Inc.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.