Class Advertisement
The wrapper class used to interact with the Unity Ads SDK.
Inherited Members
Namespace: UnityEngine.Advertisements
Assembly: UnityEngine.Advertisements.dll
Syntax
public static class Advertisement
Properties
debugMode
Returns true if the SDK is is in debug mode, and false if it isn't. Debug mode controls the level of logging from the SDK.
Declaration
public static bool debugMode { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
isInitialized
Returns true if the SDK is initialized successfully, and false if it isn't.
Declaration
public static bool isInitialized { get; }
Property Value
| Type | Description |
|---|---|
| bool |
isShowing
Returns true if an ad is currently showing, and false if it isn't.
Declaration
public static bool isShowing { get; }
Property Value
| Type | Description |
|---|---|
| bool |
isSupported
Returns true if the SDK is supported on the current platform, and false if it isn't.
Declaration
public static bool isSupported { get; }
Property Value
| Type | Description |
|---|---|
| bool |
version
Returns the current SDK version.
Declaration
public static string version { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Initialize(string)
Initializes the SDK with a specified Game ID.
Declaration
public static void Initialize(string gameId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | gameId | The platform-specific Unity game identifier for your Project, found on the developer dashboard. |
Initialize(string, bool)
Initializes the SDK with a specified Game ID and test mode setting.
Declaration
public static void Initialize(string gameId, bool testMode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | gameId | The platform-specific Unity game identifier for your Project, found on the developer dashboard. |
| bool | testMode | Test mode allows you to test your integration without serving live ads. Use |
Initialize(string, bool, IUnityAdsInitializationListener)
Initializes the SDK with a specified Game ID, test mode setting, and Placement load setting.
Declaration
public static void Initialize(string gameId, bool testMode, IUnityAdsInitializationListener initializationListener)
Parameters
| Type | Name | Description |
|---|---|---|
| string | gameId | The platform-specific Unity game identifier for your Project, found on the developer dashboard. |
| bool | testMode | Test mode allows you to test your integration without serving live ads. Use |
| IUnityAdsInitializationListener | initializationListener | Listener for IUnityAdsInitializationListener callbacks |
Load(string)
Loads ad content for a specified Placement.
Declaration
public static void Load(string placementId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
See Also
Load(string, IUnityAdsLoadListener)
Loads ad content for a specified Placement.
Declaration
public static void Load(string placementId, IUnityAdsLoadListener loadListener)
Parameters
| Type | Name | Description |
|---|---|---|
| string | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
| IUnityAdsLoadListener | loadListener | A listener for |
See Also
SetMetaData(MetaData)
Sets various metadata for the SDK.
Declaration
public static void SetMetaData(MetaData metaData)
Parameters
| Type | Name | Description |
|---|---|---|
| MetaData | metaData | A metadata container. |
Show(string)
Displays an ad in a specified Placement if it is ready.
Declaration
public static void Show(string placementId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
Show(string, IUnityAdsShowListener)
Displays an ad in a specified Placement if it is ready.
Declaration
public static void Show(string placementId, IUnityAdsShowListener showListener)
Parameters
| Type | Name | Description |
|---|---|---|
| string | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
| IUnityAdsShowListener | showListener | A listener for |
Show(string, ShowOptions)
Displays an ad in a specified Placement if it is ready.
Declaration
public static void Show(string placementId, ShowOptions showOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| string | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
| ShowOptions | showOptions | A collection of options for modifying ad behaviour. |
Show(string, ShowOptions, IUnityAdsShowListener)
Displays an ad in a specified Placement
Declaration
public static void Show(string placementId, ShowOptions showOptions, IUnityAdsShowListener showListener)
Parameters
| Type | Name | Description |
|---|---|---|
| string | placementId | The unique identifier for a specific Placement, found on the developer dashboard. |
| ShowOptions | showOptions | A collection of options for modifying ad behaviour. |
| IUnityAdsShowListener | showListener | A listener for |
Show(ShowOptions)
Displays an ad in the default Placement if it is ready.
Declaration
[Obsolete("ShowOptions has been deprecated and no longer has callbacks. It's only function currently is to pass gamerSid")]
public static void Show(ShowOptions showOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| ShowOptions | showOptions | A collection of options for modifying ad behaviour. |