文档

Development

User Acquisition

Monetization

工业

Unity Ads Monetization

SDK 4.20.0

受支持
​

Unity API reference

Unity Ads Monetization

SDK 4.20.0

受支持
​

此页面不支持所选语言。
Unity developer guides
​
​
Unity developer guides
  • Unity SDK integration guide
  • Unity Ads privacy guide
  • Unity Ads SDK troubleshooting guide
  • Unity developer API references
  1. Unity Ads SDK Unity developer monetization
  2. Unity Ads SDK integration guide for Unity developers

Implement interstitial ads in Unity

Implement interstitial ads in your Unity project. Load ad content and display it through C# scripts between gameplay moments or app transitions.
阅读时间2 分钟
最后更新于 1 个月前

To display a full-screen interstitial ad using the
Advertisements API
, initialize the SDK, then use the
Load
function to load ad content to a placement and the
Show
function to show the ad.
注意
Starting April 1, 2026, apps that monetize with Unity Ads through direct integration through the Advertisement Legacy Package might see reduced ad performance. To avoid reduction in performance, switch to integrating Unity Ads as a bidder.
The Unity Ads network will continue to support and provide fill for all apps using direct integration. However, to maximize revenue and performance, the recommended best practice is to install the Ads Mediation package for LevelPlay, Unity's ad mediation platform.
In SDK versions 3.7.0 and later, you can use the
IUnityAdsLoadListener
and
IUnityAdsShowListener
callbacks to implement logic for when content succeeds or fails to load or show respectively.
注意
When calling the
Show
method, you must specify a placement ID, or an error will occur.

Interstitial ad example

using UnityEngine;using UnityEngine.Advertisements;public class InterstitialAdExample : MonoBehaviour, IUnityAdsLoadListener, IUnityAdsShowListener{ [SerializeField] string _androidAdUnitId = "Interstitial_Android"; [SerializeField] string _iOSAdUnitId = "Interstitial_iOS"; string _adUnitId; void Awake() { // Get the Ad Unit ID for the current platform: _adUnitId = (Application.platform == RuntimePlatform.IPhonePlayer) ? _iOSAdUnitId : _androidAdUnitId; } // Load content to the Ad Unit: public void LoadAd() { // IMPORTANT! Only load content AFTER initialization (in this example, initialization is handled in a different script). Debug.Log("Loading Ad: " + _adUnitId); Advertisement.Load(_adUnitId, this); } // Show the loaded content in the Ad Unit: public void ShowAd() { // Note that if the ad content wasn't previously loaded, this method will fail Debug.Log("Showing Ad: " + _adUnitId); Advertisement.Show(_adUnitId, this); } // Implement Load Listener and Show Listener interface methods: public void OnUnityAdsAdLoaded(string adUnitId) { // Optionally execute code if the Ad Unit successfully loads content. } public void OnUnityAdsFailedToLoad(string _adUnitId, UnityAdsLoadError error, string message) { Debug.Log($"Error loading Ad Unit: {_adUnitId} - {error.ToString()} - {message}"); // Optionally execute code if the Ad Unit fails to load, such as attempting to try again. } public void OnUnityAdsShowFailure(string _adUnitId, UnityAdsShowError error, string message) { Debug.Log($"Error showing Ad Unit {_adUnitId}: {error.ToString()} - {message}"); // Optionally execute code if the Ad Unit fails to show, such as loading another ad. } public void OnUnityAdsShowStart(string _adUnitId) { } public void OnUnityAdsShowClick(string _adUnitId) { } public void OnUnityAdsShowComplete(string _adUnitId, UnityAdsShowCompletionState showCompletionState) { }}
Next steps: To improve your implementation, refer to the Implement rewarded ads in Unity documentation.

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。

  • 在本页上
    • Interstitial ad example


报告此页面的问题
​
​