AdMob广告不显示统一

问题描述

当我使用unity时,控制台会显示Dummy LoadAD,Dummy Show等。 但是,当我在手机上对其进行测试时,它确实会显示任何广告。 我在两个按钮上设置了这两个功能。 bannerAD按钮不显示bannerAD。 videoAD按钮将关闭我的应用程序

有我的代码

using UnityEngine;
using GoogleMobileAds.Api;
using System;
using UnityEngine.UI;


public class admanageger : MonoBehavIoUr
{
    public Text adstatus;
    BannerView bannerView;
    RewardedAd rewardedAd;
    string appID = "ca-app-pub-#####~#####";
    // Start is called before the first frame update
    private void Awake()
    {

    }
    void Start()
    {
         MobileAds.Initialize(appID);

    }
    public void showbannerAD()
{
#if UNITY_ANDROID
        string adUnitId = "ca-app-pub-####/####";
#elif UNITY_IPHONE
            string adUnitId = "ca-app-pub-###/#####";
#else
            string adUnitId = "unexpected_platform";
#endif

        // Create a 320x50 banner at the top of the screen.
        this.bannerView = new BannerView(adUnitId,AdSize.Banner,AdPosition.Top);

        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();

        // Load the banner with the request.
        this.bannerView.LoadAd(request);
    }
    public void showvideoAD()
    {
#if UNITY_ANDROID
            string adUnitId = "ca-app-pub-#####/####";
#elif UNITY_IPHONE
            string adUnitId = "ca-app-pub-#####/#####";
#else
            string adUnitId = "unexpected_platform";
#endif
            this.rewardedAd = new RewardedAd(adUnitId);

            // Create an empty ad request.
            AdRequest request = new AdRequest.Builder().Build();
        // Load the rewarded ad with the request.
         this.rewardedAd.LoadAd(request);
        this.rewardedAd.Show();

    }
}

我做错了什么还是对Admob有需求吗?

解决方法

AdMob将不会在Unity编辑器上展示任何广告。您应该始终通过在手机上进行构建和测试来测试与广告相关的内容。