- Home /
AdMob ads not showing into unity3d game! Please help...
I am trying and trying to enable google ads in my unity3d game, but no success... I have google developer console, have AdMob and I have unity3d app ready to be published, only thing that is left to be done is to enable ads. So, I make an add unit at my AdMob account to get id of the add. I have followed this tutorial https://developers.google.com/mobile-ads-sdk/docs/games#unity and with compiling and so on, everything is good, but when I want to see the ads, they are not showing. Not in the editor, not in the device. Here is my script with code to show banner ad:
using System;
using UnityEngine;
using GoogleMobileAds;
using GoogleMobileAds.Api;
// Example script showing how to invoke the Google Mobile Ads Unity plugin.
public class ads : MonoBehaviour
{
void Start ()
{
RequestBanner ();
}
private void RequestBanner()
{
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
bannerView.LoadAd(request);
}
}
I have this script, named ads.cs attached to main camera in the game... I really don't know why ads are not shown, please, if anyone know what the problem is, help me.
Depends. Are you building for android or ios? Do you have any logcat log about this? Did you register to admob and got your ad unit id?
Thanks for your response, I am building for android, have ad unit id, but not logcat. Anyway, I have menaged to make banner ad work, now only left is to make interstitial ads, I need to try a couple of things with tem, if they are not working, I will post stuff that I tried here.
Anyways, I suggest you not to show you ad unit id to others. $$anonymous$$ay be against terms of use.
@GuardiaN95 Please take a look at my question if you can: stackoverflow: http://stackoverflow.com/questions/41049484/can-not-show-banner-with-google-admob-firebase-unity-plugin
unity-answers: http://answers.unity3d.com/questions/1282702/why-can-not-i-show-banner-with-google-admob-fireba.html
I have the same problem(may be as you had).
So, can you help me with showing banner ?
Answer by BowlerBitesLane · Jun 24, 2017 at 03:04 PM
Just as a heads up. For anyone who was looking around for a solution to this. If you have it working in the editor, are receiving all the right debug messages and have set up your admob account to work properly, it does take some time for AdMob to register your account properly. I set this up yesterday and for the life of me could not get the ads to display in my app. I opened the app this morning and they started displaying. So rest easy if you have followed all of the instructions here: https://developers.google.com/admob/unity/start and still don't see your ads, you may just need to wait a bit for admob to register your ads properly.
*Edit: It might be worth noting that I did upgrade to 5.6.1p4 in the process as well as setup my payment information in admob (as I think this is the point when your information is submitted to admob for them to set up your ads).
Thanks, I'll give that a shot. I'm only seeing Dummy CreateRewardBasedVideoAd and Dummy LoadAd. I imagine I can't hit Dummy RewardBasedVideoRewarded or Dummy RewardBasedVideoClosed because there is no dummy ad being loaded.
Edit: woops didn't read the "if you have it working in the editor" part. I don't have that :(
This was the solution for me. Loadings were failing with "Internal error". Woke up next morning and it was working.
THAN$$anonymous$$ YOU! I was searching for such an information while I was trying to debug this, losing my time on it (By the way, this is not cool, Admob. You could just told us so in your tutorials).
From the Unity's editor, I'm receiving in the debug console : "Dummy ShowRewardBasedVideoAd" but, for now, the video fail to load (event OnAdFailedToLoad) when I'm building it in my android phone.
I've also done these 2 things : - Put the right "Ad unit ID" in rewardBasedVideoAd.LoadAd (new AdRequest.Builder ().Build (), adUnitId); (I mean the ID from the rewarded video you must have created in your admob account for your app, and not the Admob ID of your app ... I did that mistake first because it's not well mentioned in the tutorials) - Filled up the payment informations in admob. (not mentioned too)
Now I'm just gonna wait and do something else.
EDIT : 4 hours after the admob account + rewarded video initialisation : I can see it finally appear on my android phone. Yay!
Should this also be the case with test ads? I've copied the code directly from the admob tutorial (meaning it is, I think, identical to OP's code), and I'm using the sample test ID from https://developers.google.com/admob/android/test-ads because I'm in development. It doesn't seem like there should be any wait time to register anything on an existing test account (but I suppose I don't know all the ins-and-outs. I'm using Unity Remote 5 if that changes anything.
THAN$$anonymous$$ YOU!! I was going mad over this that indeed having all my code correct and even working good with Test ID's, the application was not showing real ads on my test device while replacing the Test ID's with my App ID's in Ad$$anonymous$$ob. After Reading your solution i gave it a try and it worked!. Ad$$anonymous$$ob should have mentioned this in their tutorials..
BIG THanks @BowlerBitesLane (y) !!
Answer by mtdrume · Jul 24, 2015 at 07:40 AM
Attach this script to main camera Read through, fill in info as required
call this script ads
using System;
using UnityEngine;
using GoogleMobileAds;
using GoogleMobileAds.Api;
public class ads : MonoBehaviour
{
private BannerView bannerView;
public static adsDemo current;
void Start()
{
current = this;
RequestBanner();
}
private void RequestBanner()
{
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = "INSERT_Ad_UNIT_ID";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom);
// Register for ad events.
bannerView.AdLoaded += HandleAdLoaded;
bannerView.AdFailedToLoad += HandleAdFailedToLoad;
bannerView.AdOpened += HandleAdOpened;
bannerView.AdClosing += HandleAdClosing;
bannerView.AdClosed += HandleAdClosed;
bannerView.AdLeftApplication += HandleAdLeftApplication;
// Load a banner ad.
bannerView.LoadAd(createAdRequest());
}
// Returns an ad request with custom ad targeting.
private AdRequest createAdRequest()
{
return new AdRequest.Builder()
.AddTestDevice(AdRequest.TestDeviceSimulator)
.AddTestDevice("0123456789ABCDEF0123456789ABCDEF")
.AddKeyword("game")
.SetGender(Gender.Female)
.SetBirthday(new DateTime(1985, 1, 1))
.TagForChildDirectedTreatment(false)
.AddExtra("color_bg", "9B30FF")
.Build();
}
#region Banner callback handlers
public void HandleAdLoaded(object sender, EventArgs args)
{
print("HandleAdLoaded event received.");
}
public void HandleAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
{
print("HandleFailedToReceiveAd event received with message: " + args.Message);
}
public void HandleAdOpened(object sender, EventArgs args)
{
print("HandleAdOpened event received");
}
void HandleAdClosing(object sender, EventArgs args)
{
print("HandleAdClosing event received");
}
public void HandleAdClosed(object sender, EventArgs args)
{
print("HandleAdClosed event received");
}
public void HandleAdLeftApplication(object sender, EventArgs args)
{
print("HandleAdLeftApplication event received");
}
#endregion
}
in desired script call to show the ad unit
ads.current.bannerView.Show ();
Answer by kedhar · Sep 11, 2017 at 03:57 PM
I found a better result in this video
[1]: http://clkmein.com/q54nu2
DON'T CLIC$$anonymous$$ THIS LIN$$anonymous$$ IT'S A STUPID AD HERE'S THE REFERRED VIDEO https://www.youtube.com/watch?v=2hX9hnXuy2Y
Answer by saadali211 · Aug 29, 2018 at 07:47 AM
follow this video for detailed information.
Answer by marcosocram · Oct 08, 2017 at 01:10 AM
Use real Ad Unit Ids, even when testing.
No this is totally wrong and against Ad$$anonymous$$ob policy according to official documentation: "However, once you register an app in the Ad$$anonymous$$ob UI and create your own ad unit IDs for use in your app, you'll need to explicitly configure your device as a test device when you're developing. This is extremely important. Testing with real ads (even if you never tap on them) is against Ad$$anonymous$$ob policy and can cause your account to be suspended."
Your answer
Follow this Question
Related Questions
Unity + Admob dependencies 0 Answers
How do I enable AdMob to respond to inputs? 0 Answers
Google admob video shown only once for session 2 Answers
Admob Native Advanced Is not clickable 0 Answers