Class LevelPlay
Manages initialization and basic operations of the LevelPlay SDK. This class provides methods to initialize the SDK and handles global events for initialization success and failure.
Inherited Members
Namespace: Unity.Services.LevelPlay
Assembly: Unity.LevelPlay.dll
Syntax
public class LevelPlay
Properties
PluginVersion
Returns the LevelPlay Package version.
Declaration
public static string PluginVersion { get; }
Property Value
Type | Description |
---|---|
string |
UnityVersion
Returns the Unity Editor version.
Declaration
public static string UnityVersion { get; }
Property Value
Type | Description |
---|---|
string |
Methods
Init(string, string, LevelPlayAdFormat[])
Initializes the LevelPlay SDK with the specified app key and optional user ID and ad format list.
Declaration
public static void Init(string appKey, string userId = null, LevelPlayAdFormat[] adFormats = null)
Parameters
Type | Name | Description |
---|---|---|
string | appKey | The application key for the SDK. |
string | userId | Optional user identifier for use within the SDK. |
LevelPlayAdFormat[] | adFormats | Optional array of ad formats to initialize. |
LaunchTestSuite()
Launches the Test Suite. Mediation SDK must be initialized before calling this method.
Declaration
public static void LaunchTestSuite()
SetAdaptersDebug(bool)
Enables or disables adapters debug info.
Declaration
public static void SetAdaptersDebug(bool enabled)
Parameters
Type | Name | Description |
---|---|---|
bool | enabled | Is adapters debug info enabled |
SetConsent(bool)
Set user's GDPR consent.
Declaration
public static void SetConsent(bool consent)
Parameters
Type | Name | Description |
---|---|---|
bool | consent | Whether the user has granted consent |
SetDynamicUserId(string)
Sets a dynamic user ID that can be changed through the session and will be used in server to server rewarded ad callbacks. This parameter helps verify AdRewarded transactions and must be set before calling ShowRewardedVideo.
Declaration
public static bool SetDynamicUserId(string dynamicUserId)
Parameters
Type | Name | Description |
---|---|---|
string | dynamicUserId | The ID to be set |
Returns
Type | Description |
---|---|
bool | Was the dynamic user ID set successfully |
SetMetaData(string, string)
Allows setting extra flags, for example "do_not_sell" to allow or disallow selling or sharing personal information.
Declaration
public static void SetMetaData(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The flag to set |
string | value | The value for the flag |
SetMetaData(string, params string[])
Allows setting extra flags, for example "do_not_sell" to allow or disallow selling or sharing personal information.
Declaration
public static void SetMetaData(string key, params string[] values)
Parameters
Type | Name | Description |
---|---|---|
string | key | The flag to set |
string[] | values | The values for the flag |
SetNetworkData(string, string)
Set custom network data.
Declaration
public static void SetNetworkData(string networkKey, string networkData)
Parameters
Type | Name | Description |
---|---|---|
string | networkKey | The attribute key |
string | networkData | The attribute value |
SetPauseGame(bool)
When setting your PauseGame status to true, all your Unity 3D game activities will be paused (Except the ad callbacks). The game activity will be resumed automatically when the ad is closed. You should call the setPauseGame once in your session, before or after initializing the ironSource SDK, as it affects all ads (Rewarded Video and Interstitial ads) in the session.
Declaration
public static void SetPauseGame(bool pause)
Parameters
Type | Name | Description |
---|---|---|
bool | pause | Is the game paused |
SetSegment(LevelPlaySegment)
Set the segment a user belongs to.
Declaration
public static void SetSegment(LevelPlaySegment segment)
Parameters
Type | Name | Description |
---|---|---|
LevelPlaySegment | segment | Segment information for the current user |
ValidateIntegration()
Runs the integration validation.
Declaration
public static void ValidateIntegration()
Events
OnImpressionDataReady
Event triggered when an impression event occurs. This event is triggered on a background thread, not the Unity main thread.
Declaration
public static event Action<LevelPlayImpressionData> OnImpressionDataReady
Event Type
Type | Description |
---|---|
Action<LevelPlayImpressionData> |
OnInitFailed
Adds or removes event handlers for the SDK initialization failure event. Ensures that the same handler cannot be added multiple times.
Declaration
public static event Action<LevelPlayInitError> OnInitFailed
Event Type
Type | Description |
---|---|
Action<LevelPlayInitError> |
OnInitSuccess
Adds or removes event handlers for the SDK initialization success event. Ensures that the same handler cannot be added multiple times.
Declaration
public static event Action<LevelPlayConfiguration> OnInitSuccess
Event Type
Type | Description |
---|---|
Action<LevelPlayConfiguration> |