-
Notifications
You must be signed in to change notification settings - Fork 444
Description
[REQUIRED] Please fill in the following fields:
- Unity editor version: 2019.4.11f
- Firebase Unity SDK version: 6.16.0
- Source you installed the SDK: Unity Package Manager (.unitypackage or Unity Package Manager)
- Problematic Firebase Component: Database
- Other Firebase Components in use: Auth, Crashlytics, Messaging, Functions
- Additional SDKs you are using: Facebook, Leanplum, Amplitude, Branch (does not apply)
- Platform you are using the Unity editor on: Mac
- Platform you are targeting: iOS, Android
- Scripting Runtime: Mono, and/or IL2CPP
[REQUIRED] Please describe the issue here:
After installing Firebase Database version 6.16.0 using Unity Package Manager pressing Play in project which uses Firebase Database crashes the Unity Editor.
The Editor also did crash when installing Firebase Database through UPM
In the Unity Editor.Log I can see:
ERROR: Could not initialize persistence: Unable to find app data directory.
This seems to be causing the crash.
After looking at the Firebase Database C++ code I found out what was causing this error.
It's quite obvious as the error message can be found in database/src/desktop/core/repo.cc
By looking at that file I saw the cause was relating to GetAppDataPath
On Mac GetAppDataPath seems to be finding the Application Support directory and appending the package_name to that if that folder exists.
It seems to be using package_name for the folder which is according to the xml converter created from the bundle_id.
In my case the bundle_id was: Is.Company.App
Which lead me to the conclusion that Firebase Database was looking for the folder path
~/Library/Application Support/Is.Company.App
That folder did not exists which explained the error.
I therefore created it and after that the Unity Editor ran without crashing and I saw data being created in a subfolder of the folder I just created and no error in Unity logs.
Steps to reproduce:
Install Firebase Database 6.16.0 through Unity Package Manager.
Firebase Database might fail on install.
Create scene and c# files which starts Firebase App.
Press Play and see if crash occurs.
If the Unity Editor crashes then open Unity Editor.Log and look for:
ERROR: Could not initialize persistence: Unable to find app data directory.
To fix for MacOS
For Firebase App with bundle id (package_name): Is.Company.App
Just create the folder: ~/Library/Application Support/Is.Company.App
mkdir ~/Library/Application\ Support/Is.Company.App
To fix for Windows
For Firebase App with bundle id (package_name): Is.Company.App
Just create the folder: C:\Users[username]\AppData\Local\Is.Company.App
The folder is in path (see set) such as fx.:
LOCALAPPDATA=C:\Users[username]\AppData\Local
mkdir %LOCALAPPDATA%\Is.Company.App
Note
You might need to use upper or lowercase package_name. Just try according to your bundle_id or package_name stated in google-services.json
I did not help to downgrade to 6.15.2 and then install 6.16.0 again.