Unity3d 未在游戏统一上显示的广告

Unity3d 未在游戏统一上显示的广告,unity3d,admob,banner-ads,Unity3d,Admob,Banner Ads,我使用了以下代码在我的unity游戏上放置横幅广告,但我的广告既没有显示测试广告,也没有显示实际的admob广告。我不知道发生了什么,我也在admob中完成了我的付款详细信息 代码中缺少一个函数,用于处理bannerView对象的显示功能: using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; public class AdmobScr

我使用了以下代码在我的unity游戏上放置横幅广告,但我的广告既没有显示测试广告,也没有显示实际的admob广告。我不知道发生了什么,我也在admob中完成了我的付款详细信息


代码中缺少一个函数,用于处理bannerView对象的显示功能:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;

public class AdmobScript : MonoBehaviour 
{
     BannerView bannerView;

 void Start()
 {

    RequestBanner();
 }


 private void RequestBanner()
 {
 #if UNITY_EDITOR
 string adUnitId = "unused";

 #elif UNITY_ANDROID
     string adUnitId = BannerId;
 #elif UNITY_IPHONE
     string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
 #else
     string adUnitId = "unexpected_platform";
 #endif

     // Create a 320x50 banner at the bottom of the screen.
     BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, 
     AdPosition.Bottom);
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder().Build();
     // Load the banner with the request.
     bannerView.LoadAd(request);
     // Handle the show functionality of banner ads
     bannerView.OnAdLoaded+=HandleOnAdLoaded;
 }

 void HandleOnAdLoadeded(object a, EventArgs args) {
     print("loaded");
     bannerView.Show();
 }
}

有关更多信息:


是的,他们没有帮助,问题仍然存在检查->Unity 3d Google Play Services集成2018教程:1。如何上传游戏商店和整合谷歌游戏服务。2.如何登录用户在谷歌玩统一。3.如何在unity游戏中添加排行榜。4.如何在unity 2018游戏中添加成就。5.如何在unity中集成google admob横幅和间隙广告。6.谷歌游戏服务多人集成。7.在谷歌云上保存游戏数据。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;

public class AdmobScript : MonoBehaviour 
{
     BannerView bannerView;

 void Start()
 {

    RequestBanner();
 }


 private void RequestBanner()
 {
 #if UNITY_EDITOR
 string adUnitId = "unused";

 #elif UNITY_ANDROID
     string adUnitId = BannerId;
 #elif UNITY_IPHONE
     string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
 #else
     string adUnitId = "unexpected_platform";
 #endif

     // Create a 320x50 banner at the bottom of the screen.
     BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, 
     AdPosition.Bottom);
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder().Build();
     // Load the banner with the request.
     bannerView.LoadAd(request);
     // Handle the show functionality of banner ads
     bannerView.OnAdLoaded+=HandleOnAdLoaded;
 }

 void HandleOnAdLoadeded(object a, EventArgs args) {
     print("loaded");
     bannerView.Show();
 }