其他 Unity 安裝選項
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您不必下載包含 .NET 3.X 和 .NET 4.X 所有檔案的大型 .zip
檔案,而是可以從 Google APIs for Unity 網站下載個別套件。.unitypackage
這個網站提供:
- 個別 .NET 4.X
.unitypackage
檔案,可匯入為資產套件。
- 使用 Unity Package Manager 匯入個別
.tgz
封存檔。
如果應用程式只使用單一 Firebase 產品,這項功能就特別實用,因為個別 .unitypackage
檔案包含所有必要依附元件,且 .tgz
檔案會與相關的依附元件 .tgz
檔案一併列出。
本頁面提供 Unity 套件管理工具的相關操作說明,建議您參閱 Unity 說明文件,瞭解這項工具。
將 Firebase 套件匯入為資產
從 Google APIs for Unity 網站下載 .unitypackage
檔案並匯入 Firebase 產品時,請注意下列事項:
下載後,如要匯入,請按照下列步驟操作:
在開啟的 Unity 專案中,依序前往「Assets」 >「Import Package」 >「Custom Package」。
在「Import Unity Package」視窗,按一下「Import」。
使用 Unity Package Manager 匯入 Firebase 套件
從 Google APIs for Unity 封存檔下載 .tgz
檔案並匯入 Firebase 產品時,請注意下列事項:
這個方法僅適用於 2018.3 以上版本。
如果專案中使用了多項 Firebase 產品,請務必下載並將所有 Firebase 產品升級至相同版本。
請勿在一個專案中混用匯入方法。也就是說,請勿透過資產套件流程和 Unity 套件管理員流程匯入 Firebase 產品。
每個產品 .tgz
檔案的依附元件都會在各自的 .tgz
檔案中連結。你必須依正確順序下載並匯入產品 .tgz
檔案和依附元件 .tgz
檔案:
- 外部依附元件管理員 (
com.google.external-dependency-manager
)
- Firebase Core (
com.google.firebase.app
)
- 專案中使用的 Firebase 產品。如果您使用 Realtime Database 或 Cloud Storage,請先匯入 Authentication (
com.google.firebase.auth
)。
下載完成後,請使用下列其中一種方法,將 .tgz
檔案匯入專案:
套件管理工具 UI
- 開啟 Unity 的 Package Manager 視窗。
- 按一下「套件管理工具」視窗左上角的
+
圖示,然後選取 Add package from tarball
開啟檔案瀏覽器。
- 在檔案瀏覽器中選取所需的 tarball。
部分舊版 Unity 2019 不支援直接新增 tarball。
在這種情況下,您需要:
- 解壓縮
.tgz
檔案。
- 按一下「套件管理員」視窗左上角的
+
圖示,然後選取 Add package from disk
開啟檔案瀏覽器。
- 在檔案瀏覽器中選取解壓縮的資料夾。
manifest.json
- 在專案的
Packages
資料夾旁建立新資料夾,並命名為 GooglePackages
。
- 將
.tgz
檔案放入該資料夾。
- 使用文字編輯器開啟 Unity 專案資料夾下的
Packages/manifest.json
。
為要匯入的每個套件新增項目,將套件名稱對應至磁碟上的位置。請務必在 .tgz
檔案路徑中附加 file:
。舉例來說,如果您要匯入 com.google.firebase.storage
及其依附元件,manifest.json
會如下所示:
{
"dependencies": {
"com.google.external-dependency-manager": "file:../GooglePackages/com.google.external-dependency-manager-1.2.164.tgz",
"com.google.firebase.app": "file:../GooglePackages/com.google.firebase.app-7.1.0.tgz",
"com.google.firebase.auth": "file:../GooglePackages/com.google.firebase.auth-7.1.0.tgz",
"com.google.firebase.storage": "file:../GooglePackages/com.google.firebase.storage-7.1.0.tgz",
// com.unity package entries...
}
}
儲存 manifest.json
檔案。
Unity 重新取得焦點時,會重新載入 manifest.json
並匯入新加入的套件。
部分舊版 Unity 不支援 manifest.json
中的 .tgz
檔案。在這種情況下,您應該:
- 解壓縮
.tgz
檔案。
編輯 manifest.json
,使用解壓縮資料夾的路徑,而非 .tgz
檔案,如下所示:
{
"dependencies": {
"com.google.external-dependency-manager": "file:../GooglePackages/com.google.external-dependency-manager-1.2.164",
"com.google.firebase.app": "file:../GooglePackages/com.google.firebase.app-7.1.0",
"com.google.firebase.auth": "file:../GooglePackages/com.google.firebase.auth-7.1.0",
"com.google.firebase.storage": "file:../GooglePackages/com.google.firebase.storage-7.1.0",
// com.unity package entries...
}
}
從 Unity Package Manager 遷移至資產套件
在某些情況下,您可能想從使用 Unity Package Manager 追蹤 Firebase 產品,改為匯入 Assets
資料夾下的產品。
如果不確定使用的匯入方法,請在 Unity 專案資料夾中開啟 Packages/manifest.json
檔案。如果檔案包含以 com.google.firebase
開頭的項目,表示專案使用 Unity Package Manager 匯入。
如要遷移至資產包,請按照下列步驟操作:
記下專案中目前的 Firebase 套件版本,然後移除這些套件。
- 從「Window」選單中選取「Package Manager」。在「套件管理員」視窗中,確認已選取「套件:在專案中」。
- 請記下匯入的 Firebase 套件版本。
- 按一下每個套裝組合名稱,然後按一下「移除」。請務必移除外部依附元件管理工具套件 (
.com.google.external-dependency-manager
) 和 Firebase 套件。
下載並匯入替代 .unitypackage
檔案。您可以採用兩種方法:
- 如果可以將每個套件升級至最新版本,請下載 Firebase Unity SDK zip 檔案,然後按照「將 Firebase 新增至 Unity 專案」一文的說明匯入。
- 如需保留目前的
.unitypackage
版本,可以按照本頁面上述說明下載及匯入個別套件。
從資產套件遷移至 Unity Package Manager
在某些情況下,您可能想從匯入 Assets
資料夾下的產品,改為使用 Unity Package Manager 匯入及追蹤產品。
如果不確定使用的匯入方法,請在 Unity 專案資料夾中開啟 Packages/manifest.json
檔案。如果檔案包含以 com.google.firebase
開頭的項目,表示專案已使用 Unity Package Manager 匯入。
如要遷移至 Unity Package Manager,請按照下列步驟操作:
請使用下列任一方法,確保所有 Firebase 套件和 External Dependency Manager 套件都已從 Assets
資料夾中移除。
EDM4U UI
- 在開啟的 Unity 專案中,依序前往「Assets」>「External Dependency Manager」>「Version Handler」>「Uninstall Managed Packages」。
- 選取所有 Firebase 套件和外部依附元件管理工具。
- 按一下「Uninstall Selected Package」(解除安裝所選套件)。
手動移除
使用檔案系統工具,手動刪除下列資料夾:
Assets/Editor Default Resources/Firebase
Assets/ExternalDependencyManager
Assets/Firebase
Assets/Parse
Assets/Plugins/iOS/Firebase
使用 Unity Package Manager 匯入套件,如本頁上方所述。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-08 (世界標準時間)。
[null,null,["上次更新時間:2025-08-08 (世界標準時間)。"],[],[],null,["\u003cbr /\u003e\n\nRather than downloading a large `.zip` file containing all `.unitypackage`\nfiles for both .NET 3.X and .NET 4.X, you can download individual packages from\nthe [Google APIs for Unity site](https://developers.google.com/unity/packages).\n\nThe site provides:\n\n- Individual .NET 4.X `.unitypackage` files to import as Asset packages.\n- Individual `.tgz` archives to import using Unity Package Manager.\n\nThis is especially useful when your app uses a single Firebase product, since\nthe individual `.unitypackage` files contain all needed dependencies, and the\n`.tgz` files are listed alongside related `.tgz` files on which they depend.\n\nThis page provides instructions involving Unity Package Manager, so it's a good\nidea to learn about the tool [from the Unity documentation](https://docs.unity3d.com/Manual/Packages.html).\n| **Note:** If you still need to use .NET 3.x, download the entire Firebase SDK as described in [Add Firebase to your Unity project](/docs/unity/setup#add-sdks).\n\nImport Firebase packages as Assets\n\nWhen importing Firebase products from `.unitypackage` files downloaded from\n[Google APIs for Unity site](https://developers.google.com/unity/packages),\nkeep the following in mind:\n\n- If you are using multiple Firebase products in your project, you must download\n and upgrade all Firebase products to the same version.\n\n- Do not mix import methods in one project. That is, do not import\n Firebase products with the Asset package flow and using the Unity Package\n Manager flow.\n\nAfter downloading, to import:\n\n1. In your open Unity project, navigate to **Assets** \\\u003e **Import Package** \\\u003e\n **Custom Package**.\n\n2. In the *Import Unity Package* window, click **Import**.\n\nImport Firebase packages using Unity Package Manager\n\nWhen importing Firebase products from `.tgz` files downloaded from the [Google APIs for Unity archive](https://developers.google.com/unity/archive), keep the following in mind:\n\n- This method is only available in 2018.3+.\n\n- If you are using multiple Firebase products in your project, you must download\n and upgrade all Firebase products to the same version.\n\n- Do not mix import methods in one project. That is, do not import\n Firebase products with the Asset package flow and with the Unity Package Manager\n flow.\n\n- Dependencies for each product `.tgz` file are linked alongside in their own\n `.tgz` files. You must download and import the product `.tgz` file and\n dependency `.tgz` files, in the correct order:\n\n 1. External Dependency Manager (`com.google.external-dependency-manager`)\n 2. Firebase Core (`com.google.firebase.app`)\n 3. Firebase products used in your project. If you use Realtime Database or Cloud Storage, import Authentication (`com.google.firebase.auth`) first.\n\nAfter downloading, import `.tgz` files into your project using one of the\nfollowing methods: \n\nPackage Manager UI\n\n1. Open Unity's Package Manager window.\n2. Click the `+` icon in the top-left corner of the Package Manager window and select `Add package from tarball` to open the file browser.\n3. Select the desired tarball in the file browser.\n\nSome older versions of Unity 2019 do not support adding tarballs directly.\nIn this case, you will need to:\n\n1. Unzip the `.tgz` file.\n2. Click the `+` icon in the top-left corner of the Package Manager window and select `Add package from disk` to open the file browser.\n3. Select the extracted folder in the file browser.\n\nmanifest.json\n\n1. Create a new folder next to your project's `Packages` folder and name it `GooglePackages`.\n2. Place the `.tgz` files into that folder.\n3. Use a text editor to open `Packages/manifest.json` under your Unity project folder.\n4. Add an entry for each package you want to import, mapping the package name\n to the location on disk. Be sure to append `file:` to the `.tgz` file path. For\n example, if you were importing `com.google.firebase.storage` and its\n dependency's, your `manifest.json` would look like this:\n\n {\n \"dependencies\": {\n \"com.google.external-dependency-manager\": \"file:../GooglePackages/com.google.external-dependency-manager-1.2.164.tgz\",\n \"com.google.firebase.app\": \"file:../GooglePackages/com.google.firebase.app-7.1.0.tgz\",\n \"com.google.firebase.auth\": \"file:../GooglePackages/com.google.firebase.auth-7.1.0.tgz\",\n \"com.google.firebase.storage\": \"file:../GooglePackages/com.google.firebase.storage-7.1.0.tgz\",\n // com.unity package entries...\n }\n }\n\n5. Save the `manifest.json` file.\n\n6. When Unity regains focus it will reload the `manifest.json` and import the\n newly-added packages.\n\nSome older versions of Unity do not support `.tgz` files in the `manifest.json`.\nIn this case, you should:\n\n1. Unzip the `.tgz` file.\n2. Edit your `manifest.json` to use the path to the extracted folder, instead\n of the `.tgz` file, like so:\n\n {\n \"dependencies\": {\n \"com.google.external-dependency-manager\": \"file:../GooglePackages/com.google.external-dependency-manager-1.2.164\",\n \"com.google.firebase.app\": \"file:../GooglePackages/com.google.firebase.app-7.1.0\",\n \"com.google.firebase.auth\": \"file:../GooglePackages/com.google.firebase.auth-7.1.0\",\n \"com.google.firebase.storage\": \"file:../GooglePackages/com.google.firebase.storage-7.1.0\",\n // com.unity package entries...\n }\n }\n\nMigrate from Unity Package Manager to Asset packages\n\nIn some cases, you might want to switch from using Unity Package Manager to\ntrack Firebase products, to importing products under the `Assets` folder.\n\nIf you're not sure which import method you're using, in your Unity project\nfolder, open the file `Packages/manifest.json`. If the file contains entries\nstarting with `com.google.firebase`, your project used Unity Package Manager for\nimport.\n\nTo migrate to Asset packages:\n\n1. Note current Firebase package versions in your project and remove them.\n\n 1. From the **Window** menu, select **Package Manager** . In the *Package\n Manager* window, make sure \"Packages: In Project\" is selected.\n 2. Note the versions of imported Firebase packages.\n 3. Click on each package name, then click **Remove** . Be sure to remove the External Dependency Manager package (`.com.google.external-dependency-manager`) as well as Firebase packages.\n2. Download and import replacement `.unitypackage` files. You have two options:\n\n - If you can upgrade to the latest version of each package, download the Firebase Unity SDK zip file and import as described in [Add Firebase to\n your Unity project](/docs/unity/setup#add-sdks).\n - If you need to preserve current `.unitypackage` versions, you can download and import individual packages as described [above](#alternative_individual_unitypackages) on this page.\n\nMigrate from Asset packages to Unity Package Manager\n\nIn some cases, you might want to switch from importing products under the\n`Assets` folder to importing and tracking products with Unity Package Manager.\n\nIf you're not sure which import method you're using, in your Unity project\nfolder, open the file `Packages/manifest.json`. If the file contains entries\nstarting with `com.google.firebase` your project is already using Unity Package\nManager for import.\n\nTo migrate to Unity Package Manager:\n\n1. Make sure all Firebase packages and the External Dependency Manager package\n are removed from the `Assets` folder, using either of the following methods.\n\n EDM4U UI\n\n\n 1. In your open Unity project, navigate to **Assets \\\u003e External\n Dependency Manager \\\u003e Version Handler \\\u003e Uninstall Managed\n Packages**.\n 2. Select all Firebase packages and External Dependency Manager.\n 3. Click **Uninstall Selected Package**.\n\n \u003cbr /\u003e\n\n Manual removal\n\n Using file system tools, manually delete the following folders:\n - `Assets/Editor Default Resources/Firebase`\n - `Assets/ExternalDependencyManager`\n - `Assets/Firebase`\n - `Assets/Parse`\n - `Assets/Plugins/iOS/Firebase`\n2. Import packages using Unity Package Manager, as described [above](#alternative_unity_package_manager)\n on this page."]]