Setting Up Prime31 AdMob Plugin in Android game in Unity3D

Hi guys,

If you are also an independent Game Developer then it is very important to somehow make the game monetize so as to support you as a developer. Ofcourse We can always make our game paid, but then being an indie developer, if we do so we might lose lots of users as they might not just buy our game thinking whether its even worth buying it or not. The only way to make sure that people download our game is by making it free.

The current time has been very favaourable for the indie developers as we now have the option to make our game “freemium” which means that it is free to play but if the user really likes the game they can go ahead and buy some expansion or upgrades from inside the game and thus making sure to support the developer too in doing so along with us being very transparent in leting them know that “its worth it”. The other great way is “Ads”. I, however dislike ads but then its a very good source of revenue considering you have a moderate number of downloads and your game is really worth the replayability. As the more people play everyday, the more the chances of clicking on the ads. There’s lots of options for us in terms of ads like AdMob, MobClick, etc. I prefer to use Admob by google as its a very good option but then again its really very painful to integrate the AdMob SDK inside Unity3D, unless you are familiar with the Eclipse and Google Java Programming. I am not a hardcore programming guy and therefore learning eclipse and making my own plugin seems very time taking to me (though I have tried my hands in it just to see myself with no luck in the end) So I decided to use the Plugin made by Prime31 (http://prime31.com) Its a very good plugin and it says that its really easy to integrate it into the Unity3d Project but I dont think so. I have tried and tried and have failed to do so. There documenation is also not very friendly. So after doing lots of research in the internet I came with some luck and after some trial and error method I have managed to integrate it into my game.

So this is a small tutorial on how to inegrate it into the scene if, you also like me is having a hard time struggling with Prime31 setup.

Following is the step by Step instruction on how to set up the Prime31 Admob Plugin for Android

1 > First of all make sure that you have made a backup of your project folder just incase so as to be in the safe side.

2> Next Import the Prime31_AdMob_Android Unity package into your project

3> As of writing this post, Prime31 uses there non-prefab based plugins, where you dont have to drag the prefab like we had to before. Now there’s no need to drag the prefeab in the scene. Incase you are using the older plugin do comment below and I will make a short tutorial in that.

4> Now, Make sure you have make a blank inital scene which loads only once at the starting of the game. You can make this anything like say a logo scene or a blank scene at the start with your game graphics kind of like intro scene. We are doing this so as to make sure our ads releated all the documents are loaded inside the game using this scene.

5> Now make a empty GameObject in the scene and drag the “AdMobAndroidEventListener” script from the project view (you will find this under Plugins>ย AdMobAndroid> Demo” to the empty GameObject in the Hierarchy view.

6> Now as the “AdMobAndroidEventListener” script is a C# Script lets make a small C# script Named “CallAds” and drag that too under that empty GameObject

7> Follwing is the script content

===========================================================

public class CallAds : MonoBehaviour {
   void Start ()
   {
      AdMobAndroid.init( " use your AdMob ID here " );
      AdMobAndroid.createBanner( AdMobAndroidAd.phone320x50, AdMobAdPlacement.BottomLeft );
   }
}

==============================================================================

8> Just enter your personal AdMob ID and thats it.

9> You can also change your placement according to you.

So thats how simple it is to use the Prime31 Plugin. Do comment below if you need more information or help regarding this. I will write on how to integrate the Andrid InAppBilling using Prime31 Plugin next. Till then happy Coding and Gaming. ๐Ÿ™‚

  1. Great Tutorial…. I am also on Unity these days ๐Ÿ˜›

  2. Great.. Unity is really good and user friendly.. Do write to me if you need any help.. ๐Ÿ™‚
    Its really useful to monetise our game as an Indie Developer so that we can make more and more games. But people are not fond of paying but they try to find a new ways to get the game free. I mean they can spend huze in stupid things but is it really hard to spend a small amount of money for a entertainment? Its too less for even buying a coffee.. But they dont do it.. So Ads are a good way to monetise a game.. Also I will be writing about InApp Purchased next. Hope you will find it useful. ๐Ÿ™‚

  3. It seems my admob ads aren’t clickable when using this plugin. Can you please advise?

    • If your ads are appearing properly then most probably you have implemented it in a correct manner. I cannot know the problem without seeing it. If possible please share your game file and i can have a look. You can also contact http://www.prime31.com for the support.

    • raj
    • January 22nd, 2014

    bro,thanks its working….its very easy

    hey ,i want to add prime 31 Interstitials abmob ads at startup…..plz post script likea bove…..thanks…..

    • Glad it worked ๐Ÿ˜€
      I will make a short separate tutorial on Interstitial ads as I got many request for it. Will try to put it up asap ๐Ÿ˜€

    • raj
    • January 25th, 2014

    is this script work for Interstitials ads????….plz help

    using UnityEngine;
    using System.Collections;

    public class CallAds : MonoBehaviour {

    void Start () {
    AdMobAndroid.init( “admob id” );
    AdMobAndroid.requestInterstital( “admob id” );
    var isReady = AdMobAndroid.isInterstitalReady();
    AdMobAndroid.displayInterstital();
    }

    }

    • AnonHubbard
    • February 8th, 2014

    I had to use

    AdMobAndroid.createBanner(“pubid”, AdMobAndroidAd.phone320x50, AdMobAdPlacement.TopCenter);

    To get this working

  4. This is still accurate but you need to use the Ad unit ID in the init(). This can be found by logging in on the admob website > monetize > click your app on the left > the available ad units will be at the bottom with the ID under their name.

  1. No trackbacks yet.

You must be logged in to post a comment.