Firebase

Introduction

Firebase SDK allows developers to:

  • Change the behaviour and appearance of the game remotely and do A/B testing. (Firebase Remote Config)
  • Get clear, actionable insights into app issues with crash reporting. (Firebase Crashlytics)
  • Get insights on app usage and user engagement. (Firebase/Google Analytics)

Install Firebase SDK

  • Open the Firebase tab in LionStudios/Settings Manager menu
  • Click the “Install Firebase” button
  • Wait a few seconds for the installation to start

After installation, you can see Firebase bundle as “Installed” in Package Manager/My Registry. Firebase bundle has total of four firebase packages dependencies in it i.e,

  • Firebase Core
  • Firebase Remote config
  • Firebase Analytics (aka Google Analytics)
  • Firebase Crashlytics

Setup

After installing Firebase SDK, open the Firebase tab in LionStudios/Settings Manager . You will find warnings as shown in below image.

  • Use Browse button to locate the firebase files. Imported files should be added at the root of Assets folder.

Then:

  • For Android, run Android resolver.
  • For iOS, you don’t have to do anything. If you followed all the steps correctly, “Setup is Complete” message will appear as shown below.

Implementation

To use Firebase code, follow these Firebase documentation links for all three Firebase packages for the Unity engine.

Don’t call Firebase functions until Lion Core is initialized. You can ensure it like this:

void Awake(){    
		if (!LionCore.IsInitialized)    
		{        
				LionCore.OnInitialized += delegate        
				{            
						Debug.Log("Call firebase functions here"); 
				};    
		}
}