2

我在 Unity3D 中使用 Unity 广告实施了 AdMob 中介。

我在 AdMob 中介网络中完全添加了 Unity 广告,但我的应用不会显示来自 Unity Ads 的广告,它只显示来自 AdMob 的广告。

我的脚本中缺少什么?下面是我的脚本。

    using System;
    using UnityEngine;
    using UnityEngine.UI;
using System.Collections;
using UnityEngine.SceneManagement;
using GoogleMobileAds;
using GoogleMobileAds.Api;
using UnityEngine;
using UnityEngine.Advertisements;

public class UIManager : MonoBehaviour
{
    //AdMob
    private InterstitialAd interstitial;
    //End
}
void Awake()
{
    RequestInterstitial ();
}
private void RequestInterstitial()
{
    #if UNITY_EDITOR
    string adUnitId = "unused";
    #elif UNITY_ANDROID
    string adUnitId = "ca-app-pub-250631676/1043270594";
    #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
    string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
    #else
    string adUnitId = "unexpected_platform";
    #endif

    // Create an interstitial.
    interstitial = new InterstitialAd(adUnitId);
    // Register for ad events.
    interstitial.OnAdLoaded += HandleInterstitialLoaded;
    interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad;
    interstitial.OnAdOpening += HandleInterstitialOpened;
    interstitial.OnAdClosed += HandleInterstitialClosed;
    interstitial.OnAdLeavingApplication += HandleInterstitialLeftApplication;
    // Load an interstitial ad.
    interstitial.LoadAd(createAdRequest());
}
private void ShowInterstitial()
{
    if (interstitial.IsLoaded())
    {
        interstitial.Show();
    }
    else
    {
        print("Interstitial is not ready yet.");
    }
}
//Unity Ads
public void ShowAd()
{
    if (Advertisement.IsReady())
    {
        Advertisement.Show();
    }
}
//End 

private AdRequest createAdRequest()
{
    return new AdRequest.Builder ().Build ();
}

非常感谢你的帮助。

4

1 回答 1

0

Admob 中介以这种方式工作

  • 如果广告在该特定区域和那个时间点不可用,那么只有它会检查下一个中介网络并显示该广告。

  • 这里主要是 AdMob 优先考虑自己,所以你每次只会看到 AdMob。

于 2018-03-22T13:52:32.823 回答