Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by GuardiaN95 · Mar 14, 2015 at 02:44 PM · adsadmobgoogle

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.

Comment
Add comment · Show 10
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KurtGokhan · Mar 14, 2015 at 03:11 PM 0
Share

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?

avatar image GuardiaN95 · Mar 14, 2015 at 03:53 PM 0
Share

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.

avatar image KurtGokhan · Mar 14, 2015 at 03:59 PM 0
Share

Anyways, I suggest you not to show you ad unit id to others. $$anonymous$$ay be against terms of use.

avatar image GuardiaN95 · Mar 14, 2015 at 04:08 PM 0
Share

Thanks for that, I have hidden it. :)

avatar image GuardiaN95 · Mar 14, 2015 at 06:20 PM 0
Share

Everything works nice now. :)

avatar image Vladislav-Hromyh GuardiaN95 · Dec 08, 2016 at 10:17 PM 0
Share

@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 ?

Show more comments

7 Replies

· Add your reply
  • Sort: 
avatar image
7

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).

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tmendez · Jun 29, 2017 at 01:01 AM 0
Share

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 :(

avatar image Allen0012 · Jul 21, 2017 at 07:52 PM 0
Share

This was the solution for me. Loadings were failing with "Internal error". Woke up next morning and it was working.

avatar image Guillaumzed · Sep 08, 2017 at 10:39 AM 0
Share

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!

avatar image JustinTheSwift · Sep 29, 2017 at 01:44 PM 0
Share

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.

avatar image CharuK · Feb 11, 2018 at 12:12 PM 0
Share

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) !!

avatar image
3

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 ();
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by kedhar · Sep 11, 2017 at 03:57 PM

I found a better result in this video

[1]: http://clkmein.com/q54nu2

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image FallingRocketGames · Dec 06, 2018 at 12:03 AM 0
Share

DON'T CLIC$$anonymous$$ THIS LIN$$anonymous$$ IT'S A STUPID AD HERE'S THE REFERRED VIDEO https://www.youtube.com/watch?v=2hX9hnXuy2Y

avatar image
-1

Answer by saadali211 · Aug 29, 2018 at 07:47 AM

follow this video for detailed information.

https://youtu.be/xlEK24wbKUs

alt text


sddefault.jpg (35.9 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by marcosocram · Oct 08, 2017 at 01:10 AM

Use real Ad Unit Ids, even when testing.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Gng357 · Mar 12, 2019 at 10:01 AM 1
Share

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."

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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

Stopped Google Ads Marketing for Apple Store game 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges