UnityにFireBaseをインストール・インポートして実行したら2つエラーがでました。
・Unable to load Firebase app options
・InitializationException: Firebase app creation failed.
詳しいエラーコードは最後に記述します。
インポートしたのは、donet4/FirebaseDatabase.unitypackageです。
このサイトの手順に沿って作成しました。
https://younaship.com/2020/01/14/fire-ranking/
実行したコードはこちらです。
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using Firebase.Database; 5 6public class FireTest : MonoBehaviour 7{ 8 DatabaseReference reference; 9 // Start is called before the first frame update 10 void Start() 11 { 12 SetData(); 13 } 14 15 async void SetData() 16 { 17 DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference; 18 await reference.Child("name").SetValueAsync("山田"); 19 Debug.Log("OK"); 20 } 21}
バージョン
・Unity 2019.4.10f1
・MacOS 11.6
・FareBase (2021年11月5日に使用したもの)
Unable to load Firebase app options ([/Users/aoyagitatsuya/Library/Mobile Documents/comappleCloudDocs/Downloads_02/UnityProject/3DRun/Assets/StreamingAssets/google-services-desktop.json, /Users/aoyagitatsuya/Library/Mobile Documents/comappleCloudDocs/Downloads_02/UnityProject/3DRun/Assets/StreamingAssets/google-services.json] are missing or malformed)
UnityEngine.Debug:LogError(Object)
Firebase.Platform.FirebaseLogger:LogMessage(PlatformLogLevel, String) (at Z:/tmp/tmp.4TPRUlQqie/firebase/app/client/unity/src/Unity/FirebaseLogger.cs:95)
Firebase.LogUtil:LogMessage(LogLevel, String) (at Z:/tmp/tmp.UDVuGlT5oo/firebase/app/client/unity/proxy/LogUtil.cs:69)
Firebase.LogUtil:LogMessageFromCallback(LogLevel, String) (at Z:/tmp/tmp.UDVuGlT5oo/firebase/app/client/unity/proxy/LogUtil.cs:77)
Firebase.AppUtilPINVOKE:PollCallbacks()
Firebase.AppUtil:PollCallbacks() (at Z:/tmp/tmp.UDVuGlT5oo/firebase/app/client/unity/proxy/AppUtil.cs:32)
Firebase.Platform.FirebaseAppUtils:PollCallbacks() (at Z:/tmp/tmp.UDVuGlT5oo/firebase/app/client/unity/proxy/FirebaseAppUtils.cs:33)
Firebase.Platform.FirebaseHandler:Update() (at Z:/tmp/tmp.4TPRUlQqie/firebase/app/client/unity/src/Unity/FirebaseHandler.cs:208)
Firebase.Platform.FirebaseMonoBehaviour:Update() (at Z:/tmp/tmp.4TPRUlQqie/firebase/app/client/unity/src/Unity/FirebaseMonoBehaviour.cs:45)
InitializationException: Firebase app creation failed.
Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp+CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) (at Z:/tmp/tmp.UDVuGlT5oo/firebase/app/client/unity/proxy/FirebaseApp.cs:597)
Firebase.FirebaseApp.Create () (at Z:/tmp/tmp.UDVuGlT5oo/firebase/app/client/unity/proxy/FirebaseApp.cs:124)
Firebase.FirebaseApp.get_DefaultInstance () (at Z:/tmp/tmp.UDVuGlT5oo/firebase/app/client/unity/proxy/FirebaseApp.cs:99)
Firebase.Database.FirebaseDatabase.get_DefaultInstance () (at Z:/tmp/tmp.bo51LTxDXi/firebase/database/client/unity/proxy/FirebaseDatabase.cs:87)
Tests_011+<SetData>d__2.MoveNext () (at Assets/WebTest/Tests_011.cs:17)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <fb001e01371b4adca20013e0ac763896>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <fb001e01371b4adca20013e0ac763896>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext:ExecuteTasks() (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)
あなたの回答
tips
プレビュー