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 分最終更新 14日前
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.
At the top of your C# script, add . Then, inside your MonoBehaviour's method, register the listeners and initialize the SDK:
using Unity.Services.LevelPlay;Start()void Start(){ // Register OnInitSuccess and OnInitFailed listeners LevelPlay.OnInitSuccess += SdkInitializationCompletedEvent; LevelPlay.OnInitFailed += SdkInitializationFailedEvent; // Call the LevelPlay init API using the appKey and user ID if relevant 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 |
LevelPlay Demo Scene/Sample App
The Unity Demo Scene/Sample application demonstrates how to integrate the Ad Unit APIs in your app. In the Unity Package Manager package details view, go to Samples and import the LevelPlay Sample.
You can now implement the new Ad Unit APIs.