C# Android banner ads don't show in build
I've finished a game and published it to the Play Store, but when I go to test it the video ads work but shows nothing for my banner ads. Even though I unchecked test mode in the editor, force disabled test mode in the console, and made sure I have the correct play store ID. Here's the code for all the ads in my game:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
public class simpleAds : MonoBehaviour {
// double checked to make sure number is correct in settings of Unity Console, censored for privacy
public const string gameID = "1234567";
static public bool adReady = false;
private bool adUp = false;
// Use this for initialization
void Awake () {
// initialize with game's id and set test mode to false
Advertisement.Initialize(gameID, false);
}
// Update is called once per frame
void Update () {
if(Advertisement.IsReady()){
adReady = true;
Advertisement.Initialize(gameID, false);
}
else{
adReady = false;
}
// if(timer < 3f){
// timer += Time.deltaTime;
// }else{
if((spawnScript.isPaused && spawnScript.gameState == "paused") || spawnScript.gameState == "gameover"){
if(spawnScript.gameState == "gameover"){
}
if(Advertisement.Banner.isLoaded || Advertisement.IsReady()){
adUp = true;
Advertisement.Banner.Show();
}
}else{
if(adUp){
Advertisement.Banner.Hide();
adUp = false;
}
if(spawnScript.gameState == "videoad"){
if(Advertisement.IsReady()){
Advertisement.Show();
spawnScript.gameState = "continue";
}
}
}
}
}
You're supposed to get a banner ad at the bottom of the screen (it says banner would be here in the editor) whenever you pause or get a gameover, going away when you resume, continue, or go to your results. Am I using the right code? I saw an example that had Monetization.Initialize instead of Advertisement, but that way wouldn't let me show and hide my banner ads. Any help is always appreciated! @fafase @whydoidoit @aldonaletto @duck @clunk47 @tanoshimi
Your answer
Follow this Question
Related Questions
I have a few questions 1 Answer
Trouble with closing Unity 5 ads 0 Answers
Should I leave space for Ad's while designing my game?Also how are they implemented? 0 Answers
2021.2.7: DownloadHandlerTexture and UnityWebRequestTexture not recognized? 1 Answer
Need help/guide on how to show AdMob interstitial ads 0 Answers