Unity Firebase Auth with Google-Sign-In Unity package error

1,448 views
Skip to first unread message

Kevin Wong

unread,
Feb 14, 2021, 11:07:24 AM2/14/21
to Firebase Google Group
Hi all

I had a simple project to test firebase auth.

I wanted to import the google-sign-in unity package from here (1.0.4)

After importing it i get this error:

Multiple precompiled assemblies with the same name Unity.Tasks.dll included or the current platform. Only one assembly with the same name is allowed per platform. (Assets/Parse/Plugins/Unity.Tasks.dll)

Looking for help to fix this error!

Cheers
Kevin

Kato Richardson

unread,
Feb 16, 2021, 3:29:07 PM2/16/21
to Firebase Google Group
Hi Kevin,

Unity isn't my bread and butter, but this thread suggests it's related to locally cached data such as the packages folder. Hope that gets you steered in the right direction.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/9c359789-1e05-40be-a708-a2e793834ab7n%40googlegroups.com.


--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Patrick Martin

unread,
Feb 16, 2021, 3:52:23 PM2/16/21
to Kato Richardson, Firebase Google Group
HI Kevin!

This likely comes down to some legacy Unity support stuff. If you re-import the Firebase Authentication unitypackage (make sure you use the dotnet4 rather than the dotnet3 one), it should work itself out. Alternatively, locate `Assets/Parse/Plugins` and make sure `Unity.Compat` and `Unity.Tasks` are disabled or deleted and the same files under `dotNet45` are both enabled for "Any Platform".
image.png

The rest of this response is background, I find it interesting but you can ignore it if you wish.

So the problem comes down that Unity through to Unity 2017 shipped with an older version of Mono for its C# runtime. This was so old that it didn't actually have the `Task` class. As a result, Firebase (as well as other groups, such as Play for Google Sign In) adopted a drop-in replacement for `Task` (created for Parse, as indicated by its name).

Around this time (Unity 2017) a more recent version of the .NET runtime was added as an optional feature, and made default late in the 2018 lifecycle (if I have my timelines right). This included support for the `Task` class, async/await keywords, and a number of additional "modern" C# features that make the language much nicer to work with. Firebase still supports Unity back to 2017.4, which means that it must still support older versions of the Mono runtime (this is a recent change, and the minimum supported version was 5.6 in the not-to-distant past - only abandoned because it's increasingly difficult to even run Editor versions that old).

Which brings us to the main question, why are there two `Unity.Compat` and `Unity.Tasks` dlls in the Firebase SDK? The ones under `Parse/Plugins/` are the DLLs provided by the original Parse SDK. These contain a complete implementation of `Task` to support the asynchronous logic in Firebase. The files under `Parse/Plugins/dotNet45` conversely are just a shallow wrapper around the original Parse implementation, ensuring that existing code can function unchanged in modern .NET versions (this includes the ".NET Standard 2.0" and ".NET 4.x" Api Compatibility Level settings in modern Unity variants - why ".NET Standard 2.0" is actually >= ".NET 4.5" rather than closer to `dotNet3` is another post onto itself).

--Patrick
--

Patrick Martin | Developer Relations Engineer | martin...@google.com | 720-388-6112

Patrick Martin

unread,
Feb 16, 2021, 3:55:10 PM2/16/21
to Kato Richardson, Firebase Google Group
The "Known Issues" section of the Unity Setup page does cover this class of problems as well. You can also reference that for more debugging information.

Kevin Wong

unread,
Feb 17, 2021, 9:44:35 AM2/17/21
to Firebase Google Group
Hi Patrick, thank you again and highly appreciative for the excellent explanation. It has given me a much better understanding of what was going on regarding those 2 dll files.

I did try reimporting both Firebase Auth and the Google SSO Unity package and it resulted in some other errors, which I believe i have fixed.

I am not sure if the cause of the errors is Unity, Firebase or the Google SSO Unity package, or perhaps even a combination of the 3,.
But below is what I did for reference for anyone else running into similar issues:

Error: Type Task<> exists in both Unity.Tasks and mscorelib
I seem to have fixed this error today by doing:
  1. Remove the Unity.Compat and Unity.Tasks dlls from the Parse/ root folder
  2. Enable the Unity.Compat and Unity.Tasks dlls in the Parse/dotnet45/ folder

Error: Unable to resolve reference 'UnityEditor.iOS.Extensions.Xcode' 
Installing IOS Build support for version of Unity seems to have fixed this error

Thank you
Kevin

martin...@google.com

unread,
Feb 17, 2021, 11:47:50 AM2/17/21
to Firebase Google Group
The latter issue (requiring iOS build support on Windows) is a known issue being tracked over here: https://github.com/googlesamples/unity-jar-resolver/issues/412

There's also a newer Play Games plugin for Unity here: https://github.com/playgameservices/play-games-plugin-for-unity . But since it doesn't have iOS support, it may be a no-go for you (and the plugin you're using should be fine after the Parse fix).

Reply all
Reply to author
Forward
0 new messages