Class Advertisement
The wrapper class used to interact with the Unity Ads SDK.
Namespace: UnityEngine.Advertisements
Syntax
public static class Advertisement : object
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 |
---|---|
Boolean |
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 |
---|---|
Boolean |
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 |
---|---|
Boolean |
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 |
---|---|
Boolean |
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, Boolean)
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. |
Boolean | testMode | Test mode allows you to test your integration without serving live ads. Use |
Initialize(String, Boolean, 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. |
Boolean | 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, and passes a ShowResult
enum to the ShowOptions.resultCallback
callback when the ad finishes.
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, including |
Show(String, ShowOptions, IUnityAdsShowListener)
Displays an ad in a specified Placement if it is ready, and passes a ShowResult
enum to the ShowOptions.resultCallback
callback when the ad finishes.
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, including |
IUnityAdsShowListener | showListener | A listener for |
Show(ShowOptions)
Displays an ad in the default Placement if it is ready, and passes a ShowResult
enum to the ShowOptions.resultCallback
callback when the ad finishes.
Declaration
public static void Show(ShowOptions showOptions)
Parameters
Type | Name | Description |
---|---|---|
ShowOptions | showOptions | A collection of options, including |