为什么 Firebase SDK for unity 比它在 Firebase 网站上所说的要大?

Why is the Firebase SDK for unity bigger then what it says in the Firebase website?

我正在使用 Firebase 创建一个新项目,当我点击下载 SDK 时,上面写着它大约有 300 MB,但下载大小为 2.2 GB。 我只需要一个包,有没有办法单独下载包?

我会分几个部分回答这个问题:

  1. 可以提交错误,包括 Firebase 仪表板中的错误 here
  2. 单独下载包的最佳方式是通过 Unity 包管理器 (follow these steps)。
  3. 为什么它这么大(当然,为什么它在 Unity 包管理器、源代码管理等中没有那么大):

SDK 的大小归结为两个因素:

  1. 每个 unitypackage 包含它所依赖的所有包。因此,重复包含 FirebaseCore 甚至 FirebaseAnalytics 等常见逻辑。这大大简化了集成逻辑(Unity 足够聪明,不会导入您已经导入的代码,但不够聪明,如果您忘记了,则有条件地拉入其他 unitypackage 文件)但会增加 SDK 的大小(它本质上是一个 zip 的 zip 文件文件,每个文件都包含冗余数据)。

  2. Unity SDK 实际上构建于 open source C++ SDK 之上。由于没有很好的方法将 C++ 构建集成到 Unity 的构建系统中,这意味着 iOS、Android、MacOS、Windows 和 [=] 的每个 SDK 都有冗余副本50=] 包含在每个库和每个受支持的体系结构中。 Firebase SDK 本身支持回到 5 系列的 Unity 版本,这也意味着 Unity 本身已放弃支持但仍会从 Firebase 获得更新的 C++ 平台和工具链。

那么为什么 Unity Package Manager 集成更小?

UPM 在您的用户目录中 built on top of NPM, which means that only the exact Firebase libraries you need get downloaded. That means that you don't download .NET 3.x compatible libraries or 10 copies of Firebase Core. The packages also live in a separate Library directory in Unity (which you shouldn't keep in version control - saving space there) and can be downloaded on demand as you need them (technically they also live in a package cache

希望对您有所帮助!关于您希望如何进一步改进它的任何 comments/suggestions 都可以提交为 a feature request or as an issue on the Unity Quickstart