简体   繁体   English

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

[英]Admob mediation with unity ads in Unity3D not display Unity Ads only AdMob Ads

I was implemented AdMob Mediation with Unity Ads in Unity3D.我在 Unity3D 中使用 Unity Ads 实现了 AdMob 中介。

I completely added Unity Ads in AdMob Mediation Network, but my app won't showing ads from Unity Ads, it's showing ad from AdMob only.我在 AdMob Mediation Network 中完全添加了 Unity Ads,但我的应用程序不会显示来自 Unity Ads 的广告,它只显示来自 AdMob 的广告。

What I am missing in my script?我的脚本中缺少什么? below is my script.下面是我的脚本。

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

Thank you so much for your help.非常感谢你的帮助。

Admob mediation works in this way Admob 中介以这种方式工作

  • If ad is not available in that particular region and at that point of time, then only it will check for the next mediated network and it will show that ad.如果广告在该特定区域和时间点不可用,则只有它会检查下一个中介网络并显示该广告。

  • The main thing here is AdMob gives priority to itself, so u will only see AdMob every time.这里最主要的是 AdMob 优先考虑自己,所以你每次只会看到 AdMob。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM