feat: add Firebase Initializer

This commit is contained in:
Michel Roux 2024-01-26 23:51:40 +01:00
parent 99b350a934
commit b6865b3c54
5 changed files with 84 additions and 2 deletions

View File

@ -0,0 +1,46 @@
using Firebase;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class FirebaseInitializer : MonoBehaviour
{
public UnityEvent onFirebaseReady;
public static FirebaseInitializer Instance;
void Awake()
{
Instance = this;
}
// Start is called before the first frame update
void Start()
{
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
{
var dependencyStatus = 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.
var app = Firebase.FirebaseApp.DefaultInstance;
onFirebaseReady?.Invoke();
// Set a flag here to indicate whether Firebase is ready to use by your app.
}
else
{
UnityEngine.Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
// Firebase Unity SDK is not safe to use here.
}
});
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 153bd176c0ad8f82692512264f5245ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -4,6 +4,7 @@
"com.unity.feature.development": "1.0.1", "com.unity.feature.development": "1.0.1",
"com.unity.textmeshpro": "3.0.6", "com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.6", "com.unity.timeline": "1.7.6",
"com.unity.toolchain.linux-x86_64": "2.0.6",
"com.unity.ugui": "1.0.0", "com.unity.ugui": "1.0.0",
"com.unity.visualscripting": "1.9.1", "com.unity.visualscripting": "1.9.1",
"com.unity.modules.ai": "1.0.0", "com.unity.modules.ai": "1.0.0",

View File

@ -74,6 +74,22 @@
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.sysroot": {
"version": "2.0.7",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.sysroot.linux-x86_64": {
"version": "2.0.6",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.sysroot": "2.0.7"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": { "com.unity.test-framework": {
"version": "1.1.33", "version": "1.1.33",
"depth": 1, "depth": 1,
@ -116,6 +132,16 @@
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.toolchain.linux-x86_64": {
"version": "2.0.6",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.sysroot": "2.0.7",
"com.unity.sysroot.linux-x86_64": "2.0.6"
},
"url": "https://packages.unity.com"
},
"com.unity.ugui": { "com.unity.ugui": {
"version": "1.0.0", "version": "1.0.0",
"depth": 0, "depth": 0,

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<projectSettings> <projectSettings>
<projectSetting name="com.google.external-dependency-managerAnalyticsEnabled" value="False" />
<projectSetting name="com.google.firebaseAnalyticsEnabled" value="False" />
<projectSetting name="Google.IOSResolver.VerboseLoggingEnabled" value="False" /> <projectSetting name="Google.IOSResolver.VerboseLoggingEnabled" value="False" />
<projectSetting name="Google.PackageManagerResolver.VerboseLoggingEnabled" value="False" /> <projectSetting name="Google.PackageManagerResolver.VerboseLoggingEnabled" value="False" />
<projectSetting name="Google.VersionHandler.VerboseLoggingEnabled" value="False" /> <projectSetting name="Google.VersionHandler.VerboseLoggingEnabled" value="False" />