Siddharth
Siddharth

Reputation: 4312

Firebase Initialisation Failed in Unity Editor

For Firebase setup for my Unity game project, I was following this tutorial from first:

Getting started with Firebase in Unity (2019) - Firecasts

Within the video, there is a code to initialize a Firebase SDK:

void Start()
{
    FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(continuationAction: task =>
    {
        FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
    });
}

Now as I push the play button in Unity editor, on the spot I am getting this error dialog box: enter image description here

After I press the cancel button multiple times on different dialog boxes, I was getting these errors in the console. enter image description here

What I am doing wrong in this process that I can't able to understand! So please guide me to solve this problem.

Upvotes: 6

Views: 3455

Answers (2)

Patrick Martin
Patrick Martin

Reputation: 3131

To expand on @HamidYusifli's answer:

This is a security feature of Catalina mixed with the Firebase frameworks not being signed in a way that it likes. Resolution is a three step process.

First run and get that really annoying dialog box. Click cancel on it. You may have to do this a lot. Dialog box saying "FirebaseCppApp-6_13_0.bundle" cannot be opened because the developer cannot be verified

If you click "Move to Trash", Firebase won't work in the Unity Editor (the .bundle for MacOS containing the native C++ logic will not exist).

Next, open up System Preferences: System preferences in Apple menu

Select "Security & Privacy": System Preferences menu with a box around "Security & Privacy"

And under "General" make sure you "Allow apps downloaded from App Store and identified developers" (this will be greyed out until you click the unlock button in the bottom left) and select "Allow Anyway" for FirebaseCppApp-6_13_0.bundle. General and Allow Anyway selected in the Security & Privacy dialog

I don't know if the "Allow apps downloaded from App Store and identified developers" is necessary, but I have it set.

Finally, run your game one more time in the Unity editor. You'll now have an "Open" option: Dialog box with open option

If you click that, you should be good to go.

A note here: for some versions of MacOS Catalina, Unity, and Firebase I've had to stop and start my game one more time. I haven't had to do it lately, but note that you may have to toggle play one more time.

In my experience, you have to do this dance once per project. Even though you have to click "cancel" a lot, it seems that once you do one approval it just sticks.

I hope this helps a little bit, the original answer is accurate.

Oh, and one more note. This is going around one Apple security safeguard (you're basically saying run this C code, I trust the developer). I'm a Developer Advocate for Firebase, so I'm of course super ok with just letting Firebase do its thing and I assume that if you're using the SDK you already have some sort of implicit trust in it. You're not giving Firebase root access or anything like that, but you are running binary code on your machine (the C++ portion of which you can inspect here). You should treat development libraries just like any other executable you run on your machine, and make sure you trust the SDK before following these steps for any other integration.

Upvotes: 18

Hamid Yusifli
Hamid Yusifli

Reputation: 10137

Just go into security settings on your mac, and you will see Firebase blocked because it has an untrusted developer. Allow it there to make it all work.

Upvotes: 2

Related Questions