Firebase is a platform that helps you quickly develop high-quality apps, It is made up of a collection of features that is very handy for Unity3D, Android, iOS app developers.
In this series of tutorials, I am going to cover how to harness Firebase features to streamline your app development process. Each tutorial is designed to be compact, and follows the SRP (Single Responsibility Principle), so that you can use these take-aways quickly in your own development.
The 1st tutorial is on how to create the projects, add necessary libraries/SDKs to your project and get the app up and running.
Step I: Download Firebase Unity3D packages
-
Create a Unity3D project.
-
Unpack the file, there will be a number of different unity packages. Double click on the packages you wish to add (i.e. import) to Unity3D projects.
Note: You don’t need to import all packages, import only those packages you wish to use.
Once the packages of interest are imported to Unity3D, you will see several folders created in your project:
Step II: setup in Firebase Console
- Create a Firebase project in the Firebase console. If you already have an existing Google project associated with your mobile app, click Import Google Project.
This Firebase project has specific settings your unity project needs.
- Click Add Firebase to your Android/iOS app and follow the setup steps.
Note that if your Unity App is designed to export both Android and iOS Apps, you need create two projects for both Android and iOS.
When prompted, enter your app’s bundle ID. It’s important to enter and remember the bundle ID.
- Either you create or import an existing project in Firebase console, you ultimately will be given a config file. The file for Unity3D might be one or both of the below files:
GoogleService-Info.plist (for iOS)
Google-services.json (for Android).Add these config files to Unity3D project, anywhere in the assets folder will do. - In Unity Build Setting dialog (File > Build Settings … > Player Settings … button), remember to set the bundle ID, the same as typed in Firebase Console. This is necessary to make sure the Unity app is well connected with Firebase.
- Note that a project in Firebase console can include multiple apps, e.g. one for Android, one for iOS
Note: When you import the Firebase realtime database package, you need to change the .net version in Unity3D from “.Net 2.0 Subset” –> “.Net 2.0”
- Now build and export the Unity App to your mobile devices. It will run, for sure. Though nothing useful is added to the project yet. This however, is the fundamental step that must be followed for all the Unity Fireabase projects.
Continue with next article:
Using Firebase in Unity3D Tutorial 2: Authorization and User Login with email and password
Filed under: Programming, Unity 3d Tagged: example, firebase, how to, install, library, sdk, setup, Unity, Unity 3d
