在Unity3D中使用统一广告的Admob中介不会仅显示Unity Ads AdMob广告

时间:2017-04-21 07:40:22

标签: unity3d admob unityads

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

我在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 ();
}

非常感谢你的帮助。

1 个答案:

答案 0 :(得分:0)

Admob调解以这种方式运作

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

  • 这里的主要内容是AdMob优先考虑自己,因此您每次都只会看到AdMob。

相关问题