This is actually a fairly simple process, except that information on how to do it is scarce.
It took me over twelve hours of research, as well as trial and error in order to figure it out my first time.
Lucky you, because you now have this post to follow!

I use AdMob, which is an AdSense and AdWords program run by Google. It is free to join and easy to set up, so we will be using it for this tutorial. Click here to sign up.
Step 2. Create your ad ID.

-Then select New Ad Unit.
-Here you can choose what types of ads you want to create for your game.
- You will need Android Ads for android and iPhone ads for iOS. There process is the same for both, but you will need to use the correct code for which platform you are using.
Step 3. Once you have finished filling out your ad type, you will be given an ad unity id. Copy and paste this code somewhere safe, because you will need this from inside of Unity.
Step 4. Download the GoogleMobileAds plugin for Unity here.
Step 5. While your Unity project is running, click on the GoogleMobileAds file from your downloads and it will import it into your Unity Project. Make sure to import all files.
Step 6. For the code required to request and display ads, use this link here.
These six steps will allow you play all of your ads from within your game. However, some common errors might occur.
Error Help
Manifest unable to merge - This error means that within your Android Manifests, the min SDK and target SDK numbers are not the same for each manifest.
Check your player settings and see what you have your minimum API level set to under Other Settings. This will determine your AndroidManifest_Main files min SDK number.
Make sure all of your other Android Manifests share this same min SDK number.
Your Console window will show you exactly where your other Android Manifest files are located when you read the error.
A common reason for this error is because the Google ads plugin can only be played on Android 4.0 and up, but you have your player settings set on an older android platform as your minimum API level.
Once the min SDK is the same, make sure all of the target SDK numbers are the same as well.
Incompatible Manifests - If you get this kind of error:
[@name=com.google.android.gms.version] element:
<meta-data
@android:name="com.google.android.gms.version"

Copy what you have written down for your bundle identifier under
player settings and make sure you have that set as your package name from within your android manifest. Above you can see com.CompanyName.GameName as the package name.
This should be the format you have for your bundle identifier, except that it would be your company and game name.
No Ads being shown - If you are able to build and are not getting ads to show in your game, it might be that you have accidentally copied the wrong ad unit ID number. I did this and it took me two hours to realize it, as I was sure it couldn't have been something so stupidly simple.
Make sure where you are calling the RequestBanner() function from is accurate, as well as actually being called.
Also, it might just be that there are no ads available to be displayed at that particular moment.
No comments:
Post a Comment