Sie sind auf Seite 1von 21

Solutions – Ez Ads solves the following problems 3

Quick Setup Guide 3

Video Tutorials 3

Ez Ads Window 4

Ez Ads Component 5
API and Code Examples 5

Unity Ads Support 6


Advanced Options and Ad Callbacks 6
API and Code Examples 6

HeyZap Support 8
Advanced Options 8
API and Code Examples 9
Banner Ads 10
API and Code Examples 10
Interstitial Ads 12
API and Code Examples 12
Incentivized (Rewarded) Ads 14
API and Code Examples 14

Amazon Mobile Ads Support 16


Advanced Options 16
API and Code Examples 16
Banner Ads 18
API and Code Examples 18
Interstitial Ads 20
API and Code Examples 20

Thank you for buying our asset and for supporting its further development. This plugin was created to extend the
functionality of Unity’s native system. Should you need help, find issues or have any suggestions, don’t hesitate to
send us a message at ​support@ezentertainment.eu

Please read the quick setup guide and check out our video tutorials before you start using this asset.
Solutions – Ez Ads solves the following problems
● A reliable ads solution should be easy to understand and quick to integrate. Ez Ads helps you integrate and
easily manage any of several ads platforms, by offering you an efficient all-in-one solution.
● By having an automated initialization and management of the active ads platform, you can load, show and
hide any type of ad simply by using either one line of code or UnityEvents (for a code free solution).
● All the callbacks supported by the ad platforms (eg. AdViewed, AdSkipped, etc...) are available to you out
of the box.
● Detailed video tutorials to help get you started.
● Currently supported Ads platforms are:
○ Unity Ads SDK v2.0+
○ HeyZap SDK v10+ for Unity
○ Amazon Mobile Ads 1.0+ SDK for Unity

Quick Setup Guide


1. Import Ez Ads (from @UnityAssetStore)
2. Import the desired 3rd party SDK to your project (it is important to import the SDK of the ad platform
before enabling Ez Ads, otherwise your project will get compilation errors).
3. In the editor top menu bar → Tools → Ez → Ads (Ez Ads GameObject is a singleton so you only need one
in your game)
4. Click the Add to Scene button
5. Select the Ez Ads GameObject and enable support for your desired platform
6. Perform the platform-specific configuration.
7. Done!

Video Tutorials
Watch the introduction videos @YouTube:

Unity Ads:
How to Import Unity Ads into a Project - ​https://youtu.be/RAGpjKxYbCs
How to Use Unity Ads with Ez Ads - ​https://youtu.be/q_KYIzeUmdY

HeyZap:
How to Import HeyZap into Unity - ​https://youtu.be/o6xkeUF_6ZU
How to Use HeyZap with Ez Ads - ​https://youtu.be/am9G3X8PecU

Amazon Mobile Ads:


How to Import Amazon Mobile Ads into Unity - ​https://youtu.be/KxW1_XD3scQ
How to Use Amazon Mobile Ads with EzAds - Android - ​https://youtu.be/TRtGHmMjJ4k
How to Use Amazon Mobile Ads with EzAds - iOS - ​https://youtu.be/Tr3pEyFDrn0
Ez Ads Window
This is the Ez Ads Window. It can be opened from the
Editor top menu → Tools → Ez → Ads. Using it you
can add or remove Ez Ads to and from your currently
opened scene.
The EzAds object is a singleton and should be added
only in your main scene (or start scene) as it will
persist across scenes.
Ez Ads Component
This is the Ez Ads GameObject. From here you can
select the Ad platform you want to use.

It gives the following options:


● Show help - when enabled shows detailed
help in the inspector for all elements
● Debug - when enabled Ez Ads prints
information debug messages in the console at
runtime.

When an Ads platform is selected, another option


becomes available:
● Auto Initialization - allows Ez Ads to perform
its initialization routine as quickly as possible.
If disabled, you will need to call the
EzAds.Instance.Initialize() method to trigger a
manual initialization of the asset.
Ez Ads is a singleton. This means that it will not be destroyed and will be available for use even if you change
scenes.

API and Code Examples


To be able to use Ez Ads in your scripts, remember to add:

using​ ​Ez​.​Ads;

If the auto initialization of Ez Ads is disabled, you will need to manually initialize the system by calling:

EzAds​.​Instance​.​Initialize​();

To verify if the EzAds system has been initialized:

EzAds​.​Instance​.​IsInitialized​();​ ​//Returns true if EzAds is initialized, false otherwise


Unity Ads Support
This is the Ez Ads support script for Unity Ads. From here you enter the configuration specific for this platform.
Remember that you must have the Unity Ads SDK installed in your project before using Ez Ads.

Advanced Options and Ad Callbacks


This section covers the configuration for Unity Ads:
● Show help - when enabled shows detailed
help in the inspector for all elements
● Test mode - use Unity Ads in test mode
● Android - checkmark enabling Android support
○ Android Game ID - UnityAds gameID
for Android.
● iOS - checkmark enabling iOS support
○ iOS Game ID - UnityAds gameID for
iOS.
(NOTE: Game IDs can be found in the Unity
Ads dashboard:
https://dashboard.unityads.unity3d.com/​)
● Callbacks - enable callbacks for Ads.
○ OnAdViewedEvent - callback event
sent for a successful and complete Ad
view.
○ OnAdSkippedEvent - callback event
sent for a skipped Ad.
○ OnShowAdFailedEvent - callback event
sent for failing to show an Ad.

API and Code Examples


To be able to use Ez Ads in your scripts, remember to add:

using​ ​Ez​.​Ads;

To check if an ad is available:

EzAds​.​Instance​.​IsAdReady​();​ ​//Returns true if an Ad is available, false otherwise.

To check if an ad with a specific placement ID is available:

EzAds​.​Instance​.​IsAdReady​(​string​ placementId​);​ ​//Returns true if an Ad with the specified placement ID


is available

//Example: EzAds.Instance.IsAdReady("rewardedVideo");

To show an ad (with the default placement ID):

EzAds​.​Instance​.​ShowAd​();
To show an ad with a specific placement ID:

EzAds​.​Instance​.​ShowAd​(​string​ placementId​);

//Example: EzAds.Instance.ShowAd("video");

To show an ad with a specific placement ID and a specific gamer ID:

EzAds​.​Instance​.​ShowAd​(​string​ placementId​,​ ​string​ gamerSpecificId​);

//Example: EzAds.Instance.ShowAd("video", "gamer_A");

Generally, it is easier to add listeners to callbacks in the inspector window. However, if needed, callback listeners
can be added or removed through code, as well.

To manually add or remove a callback listener:

EzAds​.​Instance​.​AddCallbackListener​(​UnityAdsCallback​ callbackType​,​ ​UnityAction​ listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.AddCallbackListener(EzAds.UnityAdsCallback.AdViewed, MyListener);

EzAds​.​Instance​.​RemoveCallbackListener​(​UnityAdsCallback​ callbackType​,​ ​UnityAction​ listener)

//Example:
//public void MyListener() {}
//EzAds.Instance.RemoveCallbackListener(EzAds.UnityAdsCallback.AdViewed, MyListener);
HeyZap Support
This is the Ez Ads support script for HeyZap. From here you enter the configuration specific for this platform.
Remember that you must have the HeyZap SDK installed in your project before using Ez Ads.

Advanced Options
This section covers the initialization settings for
HeyZap:
● Show help - when enabled shows detailed
help in the inspector for all elements
● PublisherId - HeyZap Publisher ID. Can be
found at:
https://developers.heyzap.com/account
● Advanced Options - enables advanced
initialization options for HeyZap (if you don’t
need any of these, just set it to disabled):
○ Disable Automatic Fetching - Use this
flag to disable automatic prefetching
of ads. You must call a `Fetch` method
for every ad unit before a matching
call to a `Show` method.
○ Install Tracking Only - Use this flag to
disable all advertising functionality of
the Heyzap SDK. This should only be
used if you're integrating the SDK
solely as an install tracker.
○ Amazon Store - (Android only) Use this
flag to tell the Heyzap SDK that this
app is being distributed on the
Amazon App Store.
○ Disable Mediation - Use this flag to
disable the mediation features of the
Heyzap SDK. Only Heyzap ads will be
available.
○ Disable Automatic IAP Recording - (iOS
only) Use this flag to stop the Heyzap
SDK from automatically recording
in-app purchases.
○ Native Ads Only - (Android only) Use
this flag to disable all non-native ads &
ad networks that don't support native
ads.
○ Child Directed Ads - Use this flag to to
mark mediated ads as 'child-directed'.
This value will be passed on to
networks that support sending such an
option (for purposes of the Children's
Online Privacy Protection Act
(COPPA)).
API and Code Examples
To be able to use Ez Ads in your scripts, remember to add:

using​ ​Ez​.​Ads;

If the auto initialization of Ez Ads is disabled, you will need to manually initialize the system by calling:

EzAds​.​Instance​.​Initialize​();

To verify if the EzAds system has been initialized:

EzAds​.​Instance​.​IsInitialized​();​ ​//Returns true if EzAds is initialized, false otherwise

To launch the HeyZap Mediation Test Suite and verify that each mediated network you want to use has the
correct credentials and shows ads correctly:

EzAds​.​Instance​.​ShowHeyZapMediationTestSuite​();
Banner Ads
This section covers the Banner Ad settings and
callbacks for HeyZap:
● Banner Ads - enables banner ads and shows
advanced options.
● Banner Ad Position - default position for
banner ads (can be Top or Bottom).
● AdMob Banner Size - specify the desired size
for AdMob banners (if used/needed).
● Facebook Banner Size - specify the desired size
for Facebook banners (if used/needed).
● Callbacks - enable callbacks for banner ads:
○ OnBannerAdLoaded - callback event
sent when a Banner Ad is loaded.
○ OnBannerAdError - Callback event
sent when a Banner Ad fails to load.
They can fail when refreshing after
successfully loading!
○ OnBannerAdClick - Callback event sent
when a Banner Ad is clicked. Pause the
game, if applicable.

API and Code Examples


To change the banner ad position:

EzAds​.​Instance​.​SetBannerAdPosition​(​BannerAdPosition​ adPosition​);

//Example: EzAds.Instance.SetBannerAdPosition(EzAds.BannerAdPosition.Top);

To change the size for AdMob banners:

EzAds​.​Instance​.​SetAdMobBannerSize​(​AdMobBannerSize​ bannerSize​);

//Example: EzAds.Instance.SetAdMobBannerSize(EzAds.AdMobBannerSize.Banner);

To change the size for Facebook banners:

EzAds​.​Instance​.​SetFacebookBannerSize​(​FacebookBannerSize​ bannerSize​);

//Example: EzAds.Instance.SetFacebookBannerSize(EzAds.FacebookBannerSize.BannerRectangle_250);

To show a banner ad with the currently configured position and size:

EzAds​.​Instance​.​ShowBannerAd​();

To change the display position for the banner ad and then show it:

EzAds​.​Instance​.​ShowBannerAd​(​BannerAdPosition​ bannerPosition​);

//Example: EzAds.Instance.ShowBannerAd(EzAds.BannerAdPosition.Bottom);
To hide the currently shown banner (hidden banners can be shown again):

EzAds​.​Instance​.​HideBannerAd​();

To destroy the current banner Ad, forcing a new one to be mediated and fetched:

EzAds​.​Instance​.​DestroyBannerAd​();

Generally, it is easier to add listeners to callbacks in the inspector window. However, if needed, callback listeners
can be added or removed through code, as well.

To manually add or remove a callback listener:

EzAds​.​Instance​.​AddBannerAdCallbackListener​(​BannerAdCallback​ callbackType​,​ ​UnityAction​ listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.AddBannerAdCallbackListener(EzAds.BannerAdCallback.BannerAdClick, MyListener);

EzAds​.​Instance​.​RemoveBannerAdCallbackListener​(​BannerAdCallback​ callbackType​,​ ​UnityAction​ listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.RemoveBannerAdCallbackListener(EzAds.BannerAdCallback.BannerAdClick, MyListener);
Interstitial Ads
This section covers the Interstitial Ad settings and
callbacks for HeyZap:
● Interstitial Ads - enables interstitial ads and
shows advanced options
● Callbacks - enable callbacks for interstitial ads:
○ OnInterstitialAdShow - callback event
sent when an Ad has been displayed.
This is a good place to pause your app,
if applicable.
○ OnInterstitialAdHide - callback event
sent when an Ad has been removed
from view. This is a good place to
unpause your app, if applicable.
○ OnInterstitialAdFailed - callback event
sent when 'show' is called but there is
no Ad to be shown.
○ OnInterstitialAdAvailable - Callback
event sent when an Ad has been
loaded and is ready to be displayed;
either because we auto-fetched an Ad
or because `Fetch` was called
manually.
○ OnInterstitialAdFetchFailed - callback
event sent when an Ad has failed to
load. Called both on auto-fetch and
manual “Fetch” attempts.
○ OnInterstitialAdAudioStarting -
callback event sent when an Ad is
about to be shown and will need
audio. Mute any background music.
○ OnInterstitialAdAudioFinished -
callback event sent when an Ad no
longer needs audio. Any background
music can be resumed.

API and Code Examples


To manually fetch an interstitial ad (if automatic fetching is disabled):

EzAds​.​Instance​.​FetchInterstitialAd​();

To check if an interstitial ad is available:

EzAds​.​Instance​.​IsInterstitialAdAvailable​();​ ​//Returns true if an interstitial ad is available

To show an interstitial ad:

EzAds​.​Instance​.​ShowInterstitialAd​();
Generally, it is easier to add listeners to callbacks in the inspector window. However, if needed, callback listeners
can be added or removed through code, as well.

To manually add or remove a callback listener:

EzAds​.​Instance​.​AddInterstialAdCallbackListener​(​InterstitialAdCallback​ callbackType​,​ ​UnityAction


listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.AddInterstialAdCallbackListener(EzAds.InterstitialAdCallback.InterstitialAudioStarting
, MyListener);

EzAds​.​Instance​.​RemoveInterstialAdCallbackListener​(​InterstitialAdCallback​ callbackType​,​ ​UnityAction


listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.RemoveInterstialAdCallbackListener(EzAds.InterstitialAdCallback.InterstitialAudioStart
ing, MyListener);
Incentivized (Rewarded) Ads
This section covers the Incentivized Ad settings and
callbacks for HeyZap:
● Incentivized Ads - enables incentivized ads and
shows advanced options
● Callbacks - enable callbacks for incentivized
ads:
○ OnIncentivizedAdShow - callback
event sent when an Ad has been
displayed. This is a good place to
pause your app, if applicable.
○ OnIncentivizedAdHide - callback event
sent when an Ad has been removed
from view. This is a good place to
unpause your app, if applicable.
○ OnIncentivizedAdFailed - callback
event sent when 'show' is called but
there is no Ad to be shown.
○ OnIncentivizedAdAvailable - Callback
event sent when an Ad has been
loaded and is ready to be displayed;
either because we auto-fetched an Ad
or because `Fetch` was called
manually.
○ OnIncentivizedAdFetchFailed - callback
event sent when an Ad has failed to
load. Called both on auto-fetch and
manual “Fetch” attempts.
○ OnIncentivizedAdAudioStarting -
callback event sent when an Ad is
about to be shown and will need
audio. Mute any background music.
○ OnIncentivizedAdAudioFinished -
callback event sent when an Ad no
longer needs audio. Any background
music can be resumed.
○ OnIncentivizedAdResultComplete -
callback event sent when a
REWARDED Ad has been viewed
entirely. The user should be given a
reward.
○ OnIncentivizedAdResultIncomplete -
callback event sent when a
REWARDED Ad has been skipped. The
user should NOT be given a reward.

API and Code Examples


To manually fetch an incentivized ad (if automatic fetching is disabled):

EzAds​.​Instance​.​FetchIncentivizedAd​();

To check if an incentivized ad is available:


EzAds​.​Instance​.​IsIncentivizedAdAvailable​();​ ​//Returns true if an incentivized ad is available

To show an incentivized ad:

EzAds​.​Instance​.​ShowIncentivizedAd​();

Generally, it is easier to add listeners to callbacks in the inspector window. However, if needed, callback listeners
can be added or removed through code, as well.

To manually add or remove a callback listener:

EzAds​.​Instance​.​AddIncentivizedAdCallbackListener​(​IncentivizedAdCallback​ callbackType​,​ ​UnityAction


listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.AddIncentivizedAdCallbackListener(EzAds.IncentivizedAdCallback.IncentivizedResultCompl
ete, MyListener);

EzAds​.​Instance​.​RemoveIncentivizedAdCallbackListener​(​IncentivizedAdCallback​ callbackType​,​ ​UnityAction


listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.RemoveIncentivizedAdCallbackListener(EzAds.IncentivizedAdCallback.IncentivizedResultCo
mplete, MyListener);
Amazon Mobile Ads Support
This is the Ez Ads support script for HeyZap. From here you enter the configuration specific for this platform.
Remember that you must have the Amazon Mobile Ads SDK installed in your project before using
Ez Ads.

Advanced Options
This section covers the initialization settings for
Amazon Mobile Ads:
● Show help - when enabled shows detailed
help in the inspector for all elements
● Test Mode - enables test mode during
integration and testing of the Amazon Mobile
Ads API.
● Enable Logging - Enables writing log messages
during integration and testing of the Amazon
Mobile Ads API. Logging should not be
enabled in the production environment,
including when using Live App Testing. NOTE:
this setting affects the Amazon Mobile Asd
SDK! It is not related to Ez Ads debug
messages.
● Enable Geolocation - Enables the Amazon
Mobile Ads API to send the device's latitude
and longitude to the Amazon Mobile Ad
Network. Your app must include the correct
permissions to be able to utilize geolocation
data.
● Enable iOS support - checkmark enabling iOS
support
○ iOS App Key - Amazon Appstore
application key to identify your app
when an ad is loaded.
● Enable Android support - checkmark enabling
Android support
○ Android App Key - Amazon Appstore
application key to identify your app
when an ad is loaded.
(NOTE: The Application Keys can be found in
the Amazon Developer Console:
https://developer.amazon.com/ma/apps/mob
ile-ads-apps.html​)

API and Code Examples


To be able to use Ez Ads in your scripts, remember to add:

using​ ​Ez​.​Ads;

If the auto initialization of Ez Ads is disabled, you will need to manually initialize the system by calling:
EzAds​.​Instance​.​Initialize​();

To verify if the EzAds system has been initialized:

EzAds​.​Instance​.​IsInitialized​();​ ​//Returns true if EzAds is initialized, false otherwise


Banner Ads
This section covers the Floating Banner Ad settings
and callbacks for Amazon Mobile Ads:
● Enable Banner Ads - enables banner ads and
shows advanced options.
● Position - default position for banner ads (can
be Top or Bottom).
● Alignment - default alignment for banner ads
(can be Center, Left or Right)
● Fit - set the width of the banner ads (can be Fit
Ad Size or Fit Screen Width).
● Callbacks - enable callbacks for banner ads:
○ OnBannerAdLoaded - callback event
sent each time a banner ad is
successfully loaded.
○ OnBannerAdCollapsed - callback event
sent immediately after a floating
banner ad is collapsed. This happens
when the user clicks the close button
on an expanded ad.
○ OnBannerAdExpanded - callback event
sent immediately after the user clicks
on an expandable floating banner ad
and the ad expands.
○ OnBannerAdFailedToLoad - callback
event sent whenever the retrieval of a
banner ad fails.

API and Code Examples


To show a floating banner ad:

EzAds​.​Instance​.​ShowFloatingBannerAd​();

To hide a floating banner ad:

EzAds​.​Instance​.​HideFloatingBannerAd​();

Generally, it is easier to add listeners to callbacks in the inspector window. However, if needed, callback listeners
can be added or removed through code, as well.

To manually add or remove a callback listener:

EzAds​.​Instance​.​AddBannerAdCallbackListener​(​BannerAdCallback​ callbackType​,​ ​UnityAction​ listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.AddBannerAdCallbackListener(EzAds.BannerAdCallback.BannerLoaded, MyListener);

EzAds​.​Instance​.​RemoveBannerAdCallbackListener​(​BannerAdCallback​ callbackType​,​ ​UnityAction​ listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.RemoveBannerAdCallbackListener(EzAds.BannerAdCallback.BannerLoaded, MyListener);
Interstitial Ads
This section covers the Interstitial Ad settings and
callbacks for Amazon Mobile Ads:
● Interstitial Ads - enables interstitial ads and
shows advanced options
● Disable Automatic Load - disable automatically
loading interstitial Ads. Manual load will be
required before showing.
● Callbacks - enable callbacks for interstitial ads:
○ OnInterstitialAdLoaded - callback
event sent each time an interstitial Ad
is successfully loaded.
○ OnInterstitialAdDismissed - callback
event sent immediately after an
interstitial Ad is dismissed.
○ OnInterstitialAdFailedToLoad -
callback event sent whenever the
retrieval of an interstitial Ad fails.

API and Code Examples


To manually load an interstitial ad (if automatic loading is disabled):

EzAds​.​Instance​.​LoadInterstitialAd​();

To check if an interstitial ad is available:

EzAds​.​Instance​.​IsInterstitialAdReady​();​ ​//Returns true if an interstitial ad is available

To show an interstitial ad:

EzAds​.​Instance​.​ShowInterstitialAd​();

To attempt to show an interstitial ad and receive a bool response, depending on the result:

EzAds​.​Instance​.​ShowInterstitialAdWithResult​();​ ​//Returns true if the ad is successfully shown

Generally, it is easier to add listeners to callbacks in the inspector window. However, if needed, callback listeners
can be added or removed through code, as well.

To manually add or remove a callback listener:

EzAds​.​Instance​.​AddInterstitialAdCallbackListener​(​InterstitialAdCallback​ callbackType​,​ ​UnityAction


listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.AddInterstitialAdCallbackListener(EzAds.InterstitialAdCallback.InterstitialLoaded,
MyListener);

EzAds​.​Instance​.​RemoveInterstitialAdCallbackListener​(​InterstitialAdCallback​ callbackType​,​ ​UnityAction


listener​);

//Example:
//public void MyListener() {}
//EzAds.Instance.RemoveInterstitialAdCallbackListener(EzAds.InterstitialAdCallback.InterstitialLoaded,
MyListener);

Das könnte Ihnen auch gefallen