Documentation

LevelPlay component reference

View and edit the properties and events of the LevelPlay components to configure the LevelPlay SDK and banner, interstitial, and rewarded ads.
Read time 13 minutesLast updated a day ago

This page documents the Inspector window properties and events. You can add each component from its GameObject > Monetization menu item, or add it to an existing
GameObject
from Add Component > Monetization.
For how the components work together, refer to Introduction to LevelPlay components. For the components' public methods, refer to the LevelPlay component API reference.

LevelPlay components

The following table lists each component, its menu item, and its API reference:

Component

Menu item

API reference

LevelPlay SDKGameObject > Monetization > LevelPlay SDK
LevelPlaySdkBehaviour
Banner Ad (LevelPlay)GameObject > Monetization > Banner Ad (LevelPlay)
LevelPlayBannerAdBehaviour
Interstitial Ad (LevelPlay)GameObject > Monetization > Interstitial Ad (LevelPlay)
LevelPlayInterstitialAdBehaviour
Rewarded Ad (LevelPlay)GameObject > Monetization > Rewarded Ad (LevelPlay)
LevelPlayRewardedAdBehaviour

LevelPlay SDK component properties

The LevelPlay SDK component initializes the LevelPlay SDK. Add it once, in the first scene your game loads.
The LevelPlay SDK component contains the following properties:

Property

Description

Android App KeySets the app key used on Android, from the LevelPlay dashboard. The default is empty.
iOS App KeySets the app key used on iOS, from the LevelPlay dashboard. The default is empty.
User IDSets an optional user ID that the component passes to the SDK during initialization. Leave it empty if you don't need one. The default is empty.
Initialize On StartInitializes the SDK automatically when the component starts. Disable it to call
Initialize()
yourself, for example after you collect user consent. The default is enabled.
Persist Across ScenesKeeps the LevelPlay SDK
GameObject
loaded when you load other scenes. If a later scene also contains a LevelPlay SDK
GameObject
, the duplicate destroys itself. The default is enabled.
Pause Game During AdPauses Unity while a full-screen ad is displayed. This property is supported only on iOS. On Android, this property has no effect, so pause your game in the ad's On Ad Displayed and On Ad Closed events instead. The default is disabled.
On Init SuccessDefines the functions to call when the SDK initializes successfully. Passes
LevelPlayConfiguration
. Invoked on the Unity main thread.
On Init FailedDefines the functions to call when the SDK fails to initialize. Passes
LevelPlayInitError
. Invoked on the Unity main thread.
The Banner Ad (LevelPlay) component loads and displays a banner ad at a fixed position on the screen.
Important
The banner reads these properties when it creates the ad, on its first load. To apply changes later, call
DestroyAd()
and then
LoadAd()
.
The Banner Ad (LevelPlay) component contains the following properties:

Property

Description

Android Ad Unit IDSets the banner ad unit ID used on Android. The default is empty.
iOS Ad Unit IDSets the banner ad unit ID used on iOS. The default is empty.
Load On StartLoads the banner automatically after the SDK initializes. The default is enabled.
Display On LoadShows the banner as soon as it loads. Disable it to call
ShowAd()
yourself. The default is enabled.
SizeSets the banner size. The options are Banner, Large, Medium Rectangle, Leaderboard, Adaptive, and Custom. The default is Banner.
Adaptive WidthSets the width of the banner container.
-1
uses the screen width. The default is
-1
. This property is supported only when Size is Adaptive.
Custom WidthSets the banner width. The default is
320
. This property is supported only when Size is Custom.
Custom HeightSets the banner height. The default is
50
. This property is supported only when Size is Custom.
PositionSets the banner position: one of the nine screen anchors, which combine top, center, or bottom with left, center, or right, or Custom. The default is Bottom Center.
Custom PositionSets the offset from the top-left corner of the screen. The default is
(0, 0)
. This property is supported only when Position is Custom.
Placement NameSets an optional placement name used for reporting and targeting. The default is empty.
Respect Safe AreaKeeps the banner inside the device's safe area, away from notches and rounded corners. The default is disabled.
Bid FloorSets an optional price floor in USD.
0
or less leaves the floor unset. The default is
0
.
On Ad LoadedDefines the functions to call when the banner loads. Passes
LevelPlayAdInfo
.
On Ad Load FailedDefines the functions to call when the banner fails to load. Passes
LevelPlayAdError
.
On Ad DisplayedDefines the functions to call when the banner becomes visible. Passes
LevelPlayAdInfo
.
On Ad Display FailedDefines the functions to call when the banner fails to display. Passes
LevelPlayAdInfo
and
LevelPlayAdError
.
On Ad ClickedDefines the functions to call when the player clicks the banner. Passes
LevelPlayAdInfo
.
On Ad ExpandedDefines the functions to call when the banner expands to cover the screen. Passes
LevelPlayAdInfo
.
On Ad CollapsedDefines the functions to call when the banner returns from its expanded state. Passes
LevelPlayAdInfo
.
On Ad Left ApplicationDefines the functions to call when the app goes to the background after the player clicks the banner. Passes
LevelPlayAdInfo
.
On Ad Impression Data ReadyDefines the functions to call when impression-level revenue data is available for this banner. Passes
LevelPlayImpressionData
. Invoked on the Unity main thread.

Interstitial Ad (LevelPlay) component properties

The Interstitial Ad (LevelPlay) component loads and shows a full-screen interstitial ad, for example between levels.
The Interstitial Ad (LevelPlay) component contains the following properties:

Property

Description

Android Ad Unit IDSets the interstitial ad unit ID used on Android. The default is empty.
iOS Ad Unit IDSets the interstitial ad unit ID used on iOS. The default is empty.
Load On StartLoads the ad automatically after the SDK initializes. The default is enabled.
Auto ReloadLoads a new ad automatically after the ad closes or fails to display. The default is enabled.
Placement NameSets an optional placement used by
ShowAd()
and
IsPlacementCapped()
. The default is empty.
Bid FloorSets an optional price floor in USD.
0
or less leaves the floor unset. The default is
0
.
On Ad LoadedDefines the functions to call when the ad loads and is ready to show. Passes
LevelPlayAdInfo
.
On Ad Load FailedDefines the functions to call when the ad fails to load. Passes
LevelPlayAdError
.
On Ad DisplayedDefines the functions to call when the ad opens. Passes
LevelPlayAdInfo
.
On Ad Display FailedDefines the functions to call when the ad fails to show. Passes
LevelPlayAdInfo
and
LevelPlayAdError
.
On Ad ClickedDefines the functions to call when the player clicks the ad. Passes
LevelPlayAdInfo
.
On Ad ClosedDefines the functions to call when the player closes the ad. Passes
LevelPlayAdInfo
. Resume your game here.
On Ad Info ChangedDefines the functions to call when the ad info of a loaded ad changes. Passes
LevelPlayAdInfo
.
On Ad Impression Data ReadyDefines the functions to call when impression-level revenue data is available. Passes
LevelPlayImpressionData
. Invoked on the Unity main thread.

Rewarded Ad (LevelPlay) component properties

The Rewarded Ad (LevelPlay) component loads and shows a full-screen rewarded ad that grants the player a reward when they finish watching it.
The Rewarded Ad (LevelPlay) component contains the same properties and events as the Interstitial Ad (LevelPlay) component, plus On Ad Rewarded. The following table lists all its properties:

Property

Description

Android Ad Unit IDSets the rewarded ad unit ID used on Android. The default is empty.
iOS Ad Unit IDSets the rewarded ad unit ID used on iOS. The default is empty.
Load On StartLoads the ad automatically after the SDK initializes. The default is enabled.
Auto ReloadLoads a new ad automatically after the ad closes or fails to display. The default is enabled.
Placement NameSets an optional placement used by
ShowAd()
and
IsPlacementCapped()
. The default is empty.
Bid FloorSets an optional price floor in USD.
0
or less leaves the floor unset. The default is
0
.
On Ad LoadedDefines the functions to call when the ad loads and is ready to show. Passes
LevelPlayAdInfo
.
On Ad Load FailedDefines the functions to call when the ad fails to load. Passes
LevelPlayAdError
.
On Ad DisplayedDefines the functions to call when the ad opens. Passes
LevelPlayAdInfo
.
On Ad Display FailedDefines the functions to call when the ad fails to show. Passes
LevelPlayAdInfo
and
LevelPlayAdError
.
On Ad ClickedDefines the functions to call when the player clicks the ad. Passes
LevelPlayAdInfo
.
On Ad ClosedDefines the functions to call when the player closes the ad. Passes
LevelPlayAdInfo
. Resume your game here. Don't grant the reward here.
On Ad Info ChangedDefines the functions to call when the ad info of a loaded ad changes. Passes
LevelPlayAdInfo
.
On Ad Impression Data ReadyDefines the functions to call when impression-level revenue data is available. Passes
LevelPlayImpressionData
. Invoked on the Unity main thread.
On Ad RewardedDefines the functions to call when the player earns the reward. Passes
LevelPlayAdInfo
and
LevelPlayReward
. Grant the reward here.