- Home /
Admob works on an empty project but not on my actual project
I have been trying to get Admob to work on my game now for weeks, this is causing me soo much hassle it's got to the point where I am seeking help. I have looked at countless posts on intergrating Admob and no one has a solution for me.
I have tried Admob on 2 projects, my actual project (Not working) and on an empty project (Working). Both have the exact same code. Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class AdManager : MonoBehaviour {
private BannerView bannerView;
[SerializeField] private string appID = "...";
[SerializeField] private string bannerID = "...";
[SerializeField] private string regularID = "...";
private void Awake()
{
MobileAds.Initialize(appID);
ShowBanner();
ShowAd();
Debug.Log(PlayerPrefs.GetInt("Number of Attempts"));
Debug.Log(PlayerPrefs.GetString("No Ads"));
}
public void ShowBanner()
{
Debug.Log("Showing banner...");
this.RequestBanner();
}
public void ShowAd()
{
Debug.Log("Showing regular ad...");
this.RequestRegularAD();
PlayerPrefs.SetInt("Number of Attempts", 0);
}
private void RequestRegularAD()
{
InterstitialAd AD = new InterstitialAd(regularID);
AdRequest request = new AdRequest.Builder().Build();
AD.LoadAd(request);
AD.Show();
}
private void RequestBanner()
{
bannerView = new BannerView(bannerID, AdSize.Banner, AdPosition.Bottom);
AdRequest request = new AdRequest.Builder().Build();
bannerView.LoadAd(request);
bannerView.Show();
}
}
I have logged playerprefs and playerprefs are fine, I have the correct ID's, code is the same as the one on empty project, I have the script attached to an object, I have imported the same versions of the API's on both projects. Now I have literally ran out of ideas to what could be wrong.
I am especially curious whether someone else has had a similar problem before and how they managed to fix it.
Your answer
Follow this Question
Related Questions
can you please write rewarded ad script 0 Answers
after compiling the game "(app's name) keeps stopping" 0 Answers
how do i Disable and Enable buttons? 2 Answers
Distribute terrain in zones 3 Answers
Game crashes on player death 0 Answers