邊玩邊下載功能的最佳做法
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如果應用程式已啟用邊玩邊下載功能,可以使用這些最佳做法改善安裝延遲。
使用最新的 SDK
請為應用程式使用最新的 SDK,特別是使用下列 SDK 時:
最新的 SDK 會針對邊玩邊下載功能進行最佳化,方便在不需掃描整個應用程式二進位檔的情況下執行這項功能。如此一來,使用者首次啟動應用程式時,就能更快啟動應用程式。
使用安裝期間資產包
如要儲存大型遊戲資產,請使用 install-time 資產包。Google Play 會分析 install-time 資產包使用模式,針對下載作業做出最佳化。這樣就只會下載使用者在遊戲初始啟動期間所需的資料,大幅加快遊戲啟動速度。
下表說明遊戲搭配使用 Android App Bundle 和 Play Assets Delivery 時,邊玩邊下載功能會對哪些程式碼和資源做出最佳化。
資源格式 |
邊玩邊下載功能會最佳化的項目 |
邊玩邊下載功能不會最佳化的項目 |
Android App Bundle 檔案 |
基本模組和 install-time 動態功能 (「res/」和「values/」目錄除外) |
基本模組和 install-time 動態功能的「res/」和「values/」目錄 |
|
隨選動態功能 |
Play Asset Delivery 檔案 |
Install-time 資產包 |
Fast-follow 資產包 |
|
On-demand 資產包 |
限制預先載入的資產
只載入目前使用者體驗所需的必要項目 (例如選單或層級),而非一次預先載入所有應用程式資產。如果您在初始體驗期間載入過多資產,一開始就會使用較多網路資料。
以下列出 Unity 遊戲適用的其他建議:
修正 ANR
您也可以修正應用程式中的 ANR (應用程式無回應錯誤) 改善應用程式的「邊玩邊下載」體驗。例如移除主執行緒中的 IO 作業,就能盡可能降低 Play 在背景下載應用程式資產時發生 ANR 的機率。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Play as you Download best practices\n\nThese best practices can improve install latency when Play as you Download\nis enabled for your app.\n\nUse the latest SDKs\n-------------------\n\nUse the latest SDKs for your app, especially if you are using the following\nSDKs:\n\n- Facebook Core SDK: 11.2.0 or higher\n\n- FB Audience Network (ads): 6.5.1 or higher\n\nThe latest SDKs are optimized for Play as you Download to operate without\nscanning the entire app binary. This lets users start your app more quickly\nthe first time they launch.\n\nUse install-time asset packs\n----------------------------\n\nUse [install-time](/guide/playcore/asset-delivery#delivery-modes) asset packs to\nstore large game assets. Google Play optimizes downloads by analyzing use\npatterns of install-time asset packs. This helps the game launch much faster\nwhile only downloading data that users need during the initial game launch.\n\nThe following table shows what code and resources are optimized by Play as you\ndownload when games use an\n[Android App Bundle with Play Assets Delivery](/guide/app-bundle/app-bundle-format).\n\n| Resource format | Optimized by Play as you Download | Not optimized by Play as you Download |\n|---------------------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|\n| Android App Bundle files | Base Module and install-time dynamic features (except 'res/' and 'values/' directories) | \\`res/\\` and \\`values/\\` directories of base module and install-time dynamic features |\n| Android App Bundle files | | On-demand dynamic features |\n| Play Asset Delivery files | Install-time asset packs | Fast-follow asset packs |\n| Play Asset Delivery files | | On-demand asset packs |\n\nLimit preloaded assets\n----------------------\n\nInstead of preloading all app assets at once, only load what's needed for the\ncurrent user experience such as the menu or level. Loading too many assets\nduring the initial experience uses more network data up front.\n\nHere are some additional recommendations for Unity games:\n\n- See\n [Loading resources at runtime](https://docs.unity3d.com/2022.2/Documentation/Manual/LoadingResourcesatRuntime.html).\n\n- Split large scenes into multiple scenes to avoid loading large amounts of\n asset data at once.\n\n- Use an asset loading profiler (such as the\n [Asset Loading Profiler module in\n Unity](https://docs.unity3d.com/2022.2/Documentation/Manual/profiler-asset-loading-module.html))\n to identify asset loading optimizations for your game.\n\nFix ANRs\n--------\n\nBy fixing [ANRs](/topic/performance/vitals/anr)\n(Application Not Responding errors) in your app, you can also improve the Play\nas you Download experience of the app. For example, by removing\n[IO operations from the main thread](https://developer.android.com/topic/performance/vitals/anr#io_on_the_main_thread),\nyou can minimize ANRs from occurring while Play is downloading app assets in\nbackground."]]