This repository has been archived by the owner on Aug 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Home
Nikkolai Davenport edited this page Jun 10, 2016
·
5 revisions
The Unity Ads Helper provides a reusable integration of Unity Ads for Unity projects.
To get started:
- Download UnityAdsHelper.unitypackage.
- Import the asset package into your Unity project.
- Follow the Getting Started guide to complete your setup.
- JavaScript friendly API.
- Use of XML comments to support IntelliSense.
- Unity Ads Settings available from Edit > Unity Ads Settings.
- Codeless integration using the
UnityAdsButton
component:- Works with the Unity UI Button component.
- Updates the interactable state of a UI Button component based on the ready state of an ad placement (uses the default placement if no placement is specified).
- Includes a cool-down timer to limit how often the ad placement is available.
- Includes a toggle to indicate if the placement is rewarded.
- Initialize Unity Ads using any of the following:
- Add the UnityAdsHelper to your scene (GameObject > Unity Ads > Helper).
- Add a UnityAdsButton to your scene (GameObject > Unity Ads > Button).
- Simply call
UnityAdsHelper.Initialize()
from any script.
- An improved
Initialize
method:- Unity Ads is only initialized once per game session.
- Optionally pass in a game ID to use with initialization.
- Default to using the game ID provided by Unity Ads Settings.
- Determines which game ID to use based on build platform.
- Trims white space and checks game IDs for
null
or empty values. - Checks that Development Build is enabled before enabling Test Mode.
- Checks for common errors, and logs any issues to be aware of.
- Logs when done initializing.
- An improved
ShowAd
method:- Trims white space from the placement ID and set to
null
if empty. - Passes the
gamerSID
withShowOptions
ifrewarded
istrue
(is only used by server-to-server redeem callbacks, and should only be set for rewarded ads). - Implements a callback handler that triggers an event based on the show result.
- Checks for common errors, and logs any issues to be aware of.
- Logs each stage of showing an ad.
- Trims white space from the placement ID and set to
- Provides callback methods for events:
-
onFinished
– Called after an ad is closed. Ad was watch from beginning to end. -
onSkipped
– Called after an ad is closed. Ad was skipped before the end. -
onFailed
– Called after an ad is closed. Ad failed to show.
-