Hola,
Soy nuevo en unity pero ya he Manejado Admob en proyectos nativos para Android.
Estoy intentando colocar Admob en Unity pero se me ha hecho imposible saber que pasa, no sé si carga o si no carga si hay error o que pasa, ya incluí el Modulo sdk que hay que descargar y sigo los pasos, este es el código.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
using System;
public class Ads : MonoBehaviour {
private BannerView bannerView;
int lol = 0;
// Use this for initialization
void Start () {
string appId = "id";
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize(appId);
this.RequestBanner();
}
private void RequestBanner()
{
string adUnitId = "id";
// Create a 320x50 banner at the top of the screen.
bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Center);
// Register for ad events.
this.bannerView.OnAdLoaded += this.HandleAdLoaded;
this.bannerView.OnAdFailedToLoad += this.HandleAdFailedToLoad;
this.bannerView.OnAdOpening += this.HandleAdOpened;
this.bannerView.OnAdClosed += this.HandleAdClosed;
this.bannerView.OnAdLeavingApplication += this.HandleAdLeftApplication;
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
bannerView.LoadAd(request);
bannerView.Show(); /// he intentado con esta y SIN esta linea
}
#region Banner callback handlers
public void HandleAdLoaded(object sender, EventArgs args)
{
print("HandleAdLoaded");
// MonoBehaviour.print("HandleAdLoaded event received");
}
public void HandleAdFailedToLoad