A package for easily implementing GoogleMobileAds into a Unity Project. The GameObject linked to this script will also perpetuate through all your scenes (via DontDestroyOnLoad
), making it easily accessible from any other MonoBehaviour. This package currently only loads bannerView
and interstitialAd
Ads. Banner ads can be set up to load by default on any scenes that you specify via the Unity Editor. Sample Ads are also included for testing.
This package requires the GoogleMobileAds package which can be first installed from https://github.com/googleads/googleads-mobile-unity/releases/tag/v6.0.1. You'll need to enter your AppID there.
- Install the package or clone this repo directly into your
Assets
folder - Create an empty gameobject in the scene that loads first
- Add the
AdManager
component to that game object - Enter your Android and iOS Ad Unit IDs that you would have acquired from Admob.
And that's it! You're all set! Read on below for more configuration options (particularly for setting up scenes that need to automatiicaly load a banner).
The configuration are available via the Inspector
once the game object has been created.
Use Sample Ads
- Use sample Ad Mob IDs for all ads. Great for testingPrint Debug Messages
- Prints debug messages to the console, set this to false to hide themBanner Position
- The defaultAdPosition
for all banner adsBanner Scene Names
- Array of scene names that this package will loadbannerVIew
automatiically load on entry
To load an interstitial ad, simply grab the AdManger
instance and call the ShowInterstitial()
function.