เพิ่มประสิทธิภาพการเริ่มต้นและโหลดโฆษณา
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เลือกแพลตฟอร์ม:
Android
Unity
ตั้งแต่ SDK โฆษณาในอุปกรณ์เคลื่อนที่ของ Google (GMA) เวอร์ชัน 21.0.0 เป็นต้นไป คุณสามารถเปิดใช้
การเริ่มต้น SDK และการโหลดโฆษณาที่เพิ่มประสิทธิภาพเพื่อปรับปรุง
การตอบสนองโดยรวมของโฆษณา และช่วยป้องกันข้อผิดพลาด "แอปพลิเคชันไม่ตอบสนอง"
(ANR) ในแอป
คู่มือนี้จะอธิบายการเปลี่ยนแปลงที่คุณต้องทำเพื่อเปิดใช้การเพิ่มประสิทธิภาพเหล่านี้
ข้อกำหนด
- ปลั๊กอิน Unity ของโฆษณาในอุปกรณ์เคลื่อนที่ของ Google เวอร์ชัน 7.2.0 ขึ้นไป
อัปเดตการตั้งค่าโฆษณา Google ในอุปกรณ์เคลื่อนที่
SDK โฆษณาในอุปกรณ์เคลื่อนที่ของ Google
เปิดใช้การเพิ่มประสิทธิภาพโดยค่าเริ่มต้น และสั่งให้ SDK
ทําการเริ่มต้นและโหลดโฆษณาในเธรดเบื้องหลัง
มี Flag ต่อไปนี้ให้ใช้งานสำหรับ
Google Mobile Ads SDK
สคริปต์การตั้งค่า
ออบเจ็กต์:
- ปิดใช้การเพิ่มประสิทธิภาพการเริ่มต้น
- ปิดใช้การเพิ่มประสิทธิภาพการโหลดโฆษณา
ตรวจสอบการตั้งค่าต่อไปนี้เพื่อสั่งให้ SDK เริ่มต้นและโหลดโฆษณาในเทรดหลัก
การตั้งค่า | พฤติกรรม |
ปิดใช้การเริ่มต้น Optimize |
ปิดใช้การเพิ่มประสิทธิภาพMobileAds.initialize() การเรียกใช้การเริ่มต้น |
ปิดใช้การเพิ่มประสิทธิภาพการโหลดโฆษณา
|
เพิ่มประสิทธิภาพการเรียกให้โหลดโฆษณาสําหรับโฆษณาทุกรูปแบบ |
ปิดใช้การเพิ่มประสิทธิภาพการเรียกโหลดโฆษณา |
คุณเข้าถึงการตั้งค่าโฆษณา Google บนอุปกรณ์เคลื่อนที่ได้ผ่านเมนูชิ้นงาน Unity โดยทำดังนี้
ชิ้นงาน > โฆษณา Google ในอุปกรณ์เคลื่อนที่ > การตั้งค่า
เมื่อเลือกแล้ว UI การตั้งค่าจะปรากฏในหน้าต่าง Inspector ของ Unity Editor

โปรดทราบว่าคุณสามารถเปิดตัวเลือกอย่างใดอย่างหนึ่งหรือทั้ง 2 ตัวเลือกในแอปเดียวกันได้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-27 UTC
[null,null,["อัปเดตล่าสุด 2025-08-27 UTC"],[[["\u003cp\u003eStarting 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.\u003c/p\u003e\n"],["\u003cp\u003eThese optimizations are enabled through two flags within the Google Mobile Ads settings: \u003cstrong\u003eOptimize Initialization\u003c/strong\u003e and \u003cstrong\u003eOptimize AdLoading\u003c/strong\u003e, which offload time-consuming tasks to background threads.\u003c/p\u003e\n"],["\u003cp\u003eYou can access and modify these settings via the Unity asset menu: \u003cstrong\u003eAssets > Google Mobile Ads > Settings\u003c/strong\u003e, enabling either or both options based on your needs.\u003c/p\u003e\n"],["\u003cp\u003eBy default, both optimization flags are set to \u003ccode\u003efalse\u003c/code\u003e, requiring you to manually enable them to leverage these improvements.\u003c/p\u003e\n"]]],["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"],null,["# Optimize initialization and ad loading\n\nSelect platform: [Android](/admob/android/optimize-initialization \"View this page for the Android platform docs.\") [Unity](/admob/unity/optimize-initialization \"View this page for the Unity platform docs.\")\n\n\u003cbr /\u003e\n\nStarting from Google Mobile Ads (GMA) SDK version 21.0.0, you can enable\noptimized SDK initialization and ad loading to improve the overall\nresponsiveness of ads and help prevent [\"Application Not Responding\"\n(ANR)](//developer.android.com/topic/performance/vitals/anr) errors on your app.\nThis guide outlines the changes you need to make to enable these optimizations.\n\nRequirements\n------------\n\n- Complete the [Get Started guide](/admob/unity/quick-start).\n\n\u003c!-- --\u003e\n\n- Google Mobile Ads Unity plugin version 7.2.0 or higher.\n\nUpdate your Google Mobile Ads settings\n--------------------------------------\n\nThe\n\nGoogle Mobile Ads SDK\n\nenables optimization by default, and instructs the SDK to\nperform initialization and ad loading tasks processing on background threads.\n\nThe following flags are available for the\n\nGoogle Mobile Ads SDK\n\nsettings scriptable\nobject:\n\n- Disable initialization optimization\n- Disable ad loading optimization\n\nCheck these settings to instruct the SDK to initialize and load ads on the main\nthread:\n\n| Setting | Behavior |\n|---------------------------------|-----------------------------------------------------------------------|------------------------------------------|\n| Disable Optimize Initialization | Disables optimizing the `MobileAds.initialize()` initialization call. |\n| Disable ad loading optimization | Optimizes ad load calls for all ad formats. | Disables optimizing the ad loading call. |\n\nYou can access the Google Mobile Ads settings through the Unity asset menu:\n\n**Assets \\\u003e Google Mobile Ads \\\u003e Settings**\n\nOnce selected, the settings UI appears in your Unity Editor inspector window.\n\nNote that you can turn on one or both options in the same app."]]