Search code examples
c#firebaseunity-game-enginenugetfirebase-admin

Using Firebase Admin SDK in Unity


I am trying to follow this answer: Adding Firebase Admin SDK to Unity project

But I can't get it to work. I installed the nuget plugin for unity, I installed the firebase admin sdk package and I installed it's dependencies. I get a bunch of errors that I don't know how to fix, and I am confused even though, the person in the thread says "just follow the instructions", it doesn't work.

enter image description here


Solution

  • It looks like you're missing some dependencies (System.Collections.Immutable). Since this is provided by the system, my recommended course of action would be to open Player Settings: Screenshot of the build window, a red arrow points to the "Player Settings" button in the lower left

    And change the "Api Compatibility Level*" under "Other Settings": Screenshot of the Api Compatibility Level menu, .NET 4.x is highlighted

    I think .NET 4.x might help (and .NET Standard 2.0 is default, and it looks like that's what's in the error log), but whatever you currently have selected try the opposite.

    A final thing to try is to run this on a Windows machine if you're currently on Mac/Linux. Under some conditions, it will use the system .NET rather than the version of Mono that ships with Unity (I believe this is only the case for a UWP release build, but maybe it applies to the editor).