UnityAdPlugins

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

Unity Ad Plugin

CHECK
• Make sure that your game is switched to ANDROID PLATFORM
Learning outcome
• Integrating the Google Mobile Ads Unity plugin into an
app, which you will do here, is the first step toward
displaying AdMob ads and earning revenue.
• Once the integration is complete, you can choose an ad
format (such as native or rewarded video) to get
detailed implementation steps.
Prerequisites

• Use Unity 2018.4 or higher


• To deploy to Android
• Google Play Services 18.1.0 or higher
• Target Android API level 16 or higher
• Recommended: Create an AdMob account and
register an Android and/or iOS app
Download the Mobile Ads Unity plugin

• The Google Mobile Ads Unity plugin enables Unity developers to


easily serve Google Mobile Ads on Android and iOS apps without
having to write Java or Objective-C code.
• The plugin provides a C# interface for requesting ads that is
used by C# scripts in your Unity project.
• Use the links below to download the Unity package for the plugin
or to take a look at its code on GitHub.

• https://github.com/googleads/googleads-mobile-unity/releases
• Download Unity ad plugin from assets option
Import the
Mobile Ads
Unity plugin

Open your project in the Unity editor.


Select Assets > Import Package >
Custom Package and
Find
the GoogleMobileAdsPlugin.unitypac
kag file you downloaded

Click import by selecting all files


Include the Mobile Ads SDK

• The Google Mobile Ads Unity plugin is distributed with


the Unity Play Services Resolver library.
• This library is intended for use by any Unity plugin that
requires access to Android specific libraries (e.g., AARs)
or iOS CocoaPods.
• It provides Unity plugins the ability to declare
dependencies, which are then automatically resolved
and copied into your Unity project.
Follow the steps listed below to ensure your project
includes the Mobile Ads SDK.

• In the Unity editor, select Assets > External


Dependency Manager > Android Resolver >
Resolve.
• The Unity External Dependency Manager library will
copy the declared dependencies into the
Assets/Plugins/Android directory of your unity app
Set your AdMob app ID

• In the Unity editor,


select Assets >
Google Mobile Ads
> Settings from the
menu
• Enable AdMob by
clicking Enabled ch
eckbox
under Google
AdMob section.
Then enter your
Android and iOS
AdMob app ID in
each field
For some versions
• If your app uses Ad Manager instead of AdMob, enable
Google Ad Manager by clicking Enabled checkbox
under Google Ad Manager section
Initialize the Mobile Ads SDK

• Before loading ads,


have your app
initialize the Mobile
Ads SDK by calling
MobileAds.Initialize
()
• This needs to be
done only once,
ideally at app
launch
Here's an example of how to
call Initialize()

...
using GoogleMobileAds.Api;
...
public class GoogleMobileAdsDemoScript :
MonoBehaviour
{
public void Start()
{
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize(initStatus => { });
}
}
Select an ad format

• The Mobile Ads SDK is now included in your Unity app


when deploying to either the Android or iOS platform.
• You're now ready to implement an ad.
• AdMob offers a number of different ad formats, so you
can choose the one that best fits your user experience
needs
Banner
• Banner ads are rectangular image or text ads that
occupy a spot within an app's layout.
• They stay on screen while users are interacting with the
app, and can refresh automatically after a certain period
of time.
• If you're new to mobile advertising, they're a great
place to start

• Link:
https://developers.google.com/admob/unity/banner
Native
• Native is a component-based ad format that gives you
the freedom to customize the way assets such as
headlines and calls to action are presented in their
apps.
• By choosing fonts, colors, and other details for yourself,
you can create natural, unobtrusive ad presentations
that can add to a rich user experience

• Link:
https://developers.google.com/admob/unity/native-advanced-unified
Rewarded
• Rewarded video ads are full-screen video ads that users
have the option of watching in full in exchange for in-
app rewards

• Link:
https://developers.google.com/admob/unity/rewarded
END

You might also like