RSS

Using Firebase in Unity3D Tutorial 1: Basics and setup

21 Jan

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

  1. Download Firebase Unity SDK.
  2. Create a Unity3D project.
  3. 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.

 

image

 

Once the packages of interest are imported to Unity3D, you will see several folders created in your project:

image

 

Step II: setup in Firebase Console

  1. 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.


    image

 

  • 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.

image
image

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.https://xinyustudio.files.wordpress.com/2017/01/image5.png?w=645
  • Note that a project in Firebase console can include multiple apps, e.g. one for Android, one for iOS

    image

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”

image

image

  • 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

Advertisements
 
1 Comment

Posted by on January 21, 2017 in Programming, Unity 3d

 

Tags: , , , , , , , ,

One response to “Using Firebase in Unity3D Tutorial 1: Basics and setup

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: