Unity Ads Interstitial
-
Description
Unity Ads Interstitial
The Unity Ads Interstitial component allows to place ads in your application. Interstitial are full-screen ads that cover the interface of your application. They are usually displayed at natural transition points in the flow of an application, such as between activities or during the break between levels in a game. When an application shows an interstitial ad, the user has the option to see the ad or close it and return to the application.
In order to use Unity Ads we must create an account in Unity. -
Events
- On Unity Ads Click
- This event fires when the player clicks the banner ad.
- On Unity Ads Error
- This event fires when an error occurs with Unity Ads. This method can be
used to assist in debugging efforts, as well as for collect statistics on various failure
scenarios. Values:
- NOT_INITIALIZED: An attempt to show an ad was made before Unity Ads was initialized.
- INITIALIZE_FAILED: Some condition prevented Unity Ads from being initialized.
- INVALID_ARGUMENT: An invalid value was passed to the Unity Ads API.
- VIDEO_PLAYER_ERROR: An error was encountered during video playback.
- INIT_SANITY_CHECK_FAIL: The device environment sanity check failed. Unity Ads will not function.
- AD_BLOCKER_DETECTED: An ad blocker was detected running on device. Unity Ads will not function.
- FILE_IO_ERROR: An error occurred while attempting to write a file to device storage.
- DEVICE_ID_ERROR: The device ID was not found or was invalid. Unity Ads will not function.
- SHOW_ERROR: An attempt to show an ad failed before the video started.
- INTERNAL_ERROR: Some other internal error occurred.
- On Unity Ads Finish
- This event is called after the ad placement is closed. This callback
method can be used to reward players for
opting-in to watch video ads. The parameter
'result' return the state in which the ad was finished. Values:
- COMPLETED: The player viewed the ad in its entirety..
- SKIPPED: The player skipped the ad before it played in its entirety.
- ERROR: The ad failed to load.
- On Unity Ads PlacementState Changed
- This event is called after the placement state is changed. Values:
- READY: A campaign is available and ready to be shown.
- NOT_AVAILABLE: Either the SDK is not yet initialized, or the specified placement ID is invalid. For a placement ID to be valid, it must be listed among the placements for the Android platform of your project in the Unity Ads dashboard.
- DISABLED: The specified placement is currently disabled for the Android
platform of your project. Placement settings can be updated from Unity Ads
Dashboard.
. - WAITING: The specified placement is in the process of becoming ready.
- NO_FILL: There are no campaigns currently available.
- On Unity Ads Ready
- This method is called when the specified ad placement becomes ready to show an ad campaign.
- On Unity Ads Start
- This method is called at the start of video playback for the ad campaign being shown.
-
Procedures
- Load Unity Ads Interstitial
- This method allows us to upload our ad. For this to work there is that add the 'Game id' in designer or in the property 'Game id'.
- Show Unity Ads Interstitial
- Shows an ad campaign using the specified ad placement. After the ad is shown, the event 'On Unity Ads Finish' will be called when the ad placement is closed.
-
Properties
- Game Id
- The platform specific game identifier. This can be found listed under
your project in the Unity Ads
Dashboard.
.
- Test Mode
- Enables Test Mode. While Test Mode is enabled, only test ads will be shown. Test ads do not generate any stats or revenue.
-
Example
- Adding Unity Ads Interstitial
- In this case we added 'Game Id', 'Test Mode' and method 'Load Unity Ads Interstitial' in Event 'Initialize' from Screen.
Next, we added one Button and use the Event 'On Click' for show Ad.
We compile and we already have our ad