最佳化初始化和廣告載入
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
從 Google Mobile Ads (GMA) SDK 21.0.0 版開始,您可以啟用最佳化 SDK 初始化和廣告載入功能,提升廣告整體回應速度,並協助避免應用程式發生「應用程式沒有回應」(ANR) 錯誤。
本指南將說明啟用這些最佳化功能時需要進行的變更。
需求條件
- Google Mobile Ads Unity 外掛程式 7.2.0 以上版本。
更新 Google 行動廣告設定
Google Mobile Ads SDK 預設會啟用最佳化功能,並指示 SDK 在背景執行初始化和廣告載入工作。
Google Mobile Ads SDK 設定可編寫指令碼的物件提供下列標記:
請檢查下列設定,指示 SDK 在主要執行緒上初始化及載入廣告:
設定 | 行為 |
停用最佳化初始化 |
停用最佳化 MobileAds.initialize() 初始化呼叫。 |
停用廣告載入最佳化
|
針對所有廣告格式最佳化廣告載入呼叫。 |
停用最佳化廣告載入呼叫。 |
您可以透過 Unity 資產選單存取 Google 行動廣告設定:
「素材資源」>「Google 行動廣告」>「設定」
選取後,設定使用者介面會顯示在 Unity 編輯器檢查器視窗中。

請注意,您可以在同一個應用程式中開啟一或兩個選項。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-22 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-22 (世界標準時間)。"],[[["Starting with Google Mobile Ads SDK version 21.0.0, you can optimize SDK initialization and ad loading to enhance ad responsiveness and mitigate ANR errors."],["These optimizations are enabled through two flags within the Google Mobile Ads settings: **Optimize Initialization** and **Optimize AdLoading**, which offload time-consuming tasks to background threads."],["You can access and modify these settings via the Unity asset menu: **Assets \\\u003e Google Mobile Ads \\\u003e Settings**, enabling either or both options based on your needs."],["By default, both optimization flags are set to `false`, requiring you to manually enable them to leverage these improvements."]]],["Optimized SDK initialization and ad loading can be enabled in Google Mobile Ads (GMA) SDK version 21.0.0 and higher, preventing \"Application Not Responding\" (ANR) errors. To activate, update to Google Mobile Ads Unity plugin version 7.2.0 or higher. In Unity's **Assets \u003e Google Mobile Ads \u003e Settings**, enable **Optimize Initialization** and/or **Optimize AdLoading**. These settings offload initialization and ad loading to background threads. Both flags are `false` by default.\n"]]