Migrate to LevelPlay Init API
Transition to the LevelPlay initialization APIs to support the new Ad Unit APIs, starting from SDK version 8.4.0 and required in SDK version 9.0.0+.
阅读时间1 分钟最后更新于 1 天前
This guide explains how to initialize LevelPlay when transitioning to the new Ad Unit APIs.
Prerequisites
The minimum supported SDK is 8.4.0. You can download the latest SDK by installing the latest Ads Mediation package in Unity Package Manager, by upgrading from the Network Manager, or following instructions here.Initialize the SDK
To initialize the LevelPlay SDK, follow these steps:- Remove the callbacks and ad formats that previously referenced the legacy IronSource APIs.
- Implement callbacks for initialization success and failure.
- Call the LevelPlay init API using the appKey and user ID if relevant.
- Create Banner, Interstitial, and Rewarded ad objects.
using com.unity.services.levelplay;// Init the SDK when implementing the Ad Unit APIs for Banner, Interstitial, and Rewarded ad formats. LevelPlay.OnInitSuccess += SdkInitializationCompletedEvent;LevelPlay.OnInitFailed += SdkInitializationFailedEvent;LevelPlay.Init("YOUR_APPKEY", "UserId");
LevelPlay Init Listeners
OnInitSuccessOnInitFailedLegacy | Ad Unit (new) | |
|---|---|---|
| Class | IronSource | LevelPlay |
| API | init | Init |
| API | setUserID | Should be set as part of the Init |
| Callbacks | onInitializationComplete | OnInitSuccess |
| - | OnInitFailed |