- Home /
Google admob video shown only once for session
I Have another problem with ads, in my app can be shown 2 ads. 1 banner that is loaded when the app starts, which is always shown and works fine. There is another ad, which is a video ad shown to the player by clicking a "show add button for bonus life" after a "GAME OVER". It works only one time, after the first match, no ads are shown if the player try to get his bonus life after a game over... Any suggestions? I will paste the code:
Please consider the #android version only
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using admob;
public class AdManager : MonoBehaviour {
public static AdManager Instance{set;get;}
public static int inizializzato = 0;
public string bannerId;
public string videoId;
public static int bonuslife = 1;
private void Start(){
if (inizializzato == 0){
Instance = this;
DontDestroyOnLoad(gameObject);
inizializzato = 1;
#if UNITY_EDITOR
#elif UNITY_ANDROID
Admob.Instance ().initAdmob(bannerId,videoId);
Admob.Instance ().setTesting(true); //EDITOR MODE
Admob.Instance ().loadInterstitial ();
#endif
}
else
{
return;
}
}
public void showBanner()
{
#if UNITY_EDITOR
Debug.Log ("BannerAd");
#elif UNITY_ANDROID
Admob.Instance ().showBannerRelative (AdSize.Banner, AdPosition.BOTTOM_CENTER, 0);
#endif
}
public void showVideo()
{
//if(bonuslife == 1){
#if UNITY_EDITOR
Debug.Log ("VideoAd");
if(bonuslife == 1){
bonuslife = 0;
Application.LoadLevel("PlayZone");
}
else{
Application.LoadLevel("DefinitiveGameOver");
}
#elif UNITY_ANDROID
if (Admob.Instance ().isInterstitialReady () && bonuslife == 1)
{
Admob.Instance ().showInterstitial ();
Admob.Instance ().initAdmob(bannerId,videoId);
Admob.Instance ().loadInterstitial ();
bonuslife = 0;
Application.LoadLevel("PlayZone");
}
else {
if(bonuslife == 0){
Application.LoadLevel("DefinitiveGameOver");
}
else{
Application.LoadLevel("NoVideoGameOver");
bonuslife = 0;
}
}
#endif
//}
}
}
OLD QUESTION - SOLVED BY DELETING ALL THE MANIFESTS AND CREATING A CUSTOM NEW ONE I'm just adding the ads in my game because I finished it. I was following this tutorial: https://www.youtube.com/watch?v=khlROw-PfNE because it's the first time that I use Google Admob, I followed the video but I have a lot of errors while building the game. So i google a lot and I decided to download the last version of the plugin from the site. But I dont know, it seems that all changed, for example "using AdMob now is replaced with "using GoogleMobileAds" I replaced that and now nothing works. The code seems completely wrong... Does anyone has an update tutorial? or can check my code? thanks
Answer by unity_G2yrNlWYdpJKuw · Oct 18, 2017 at 06:07 PM
I also used that video and it works completely fine... You are using googlemobile ads instead of admob. Check your code again...
Adding the plugin, without using it in any script gives me errors while building the apk
I removed the manifest.xml from the plugin folder and now it works, why? should it ruin something?
Your answer
![](https://koobas.hobune.stream/wayback/20220612141339im_/https://answers.unity.com/themes/thub/images/avi.jpg)