Class Advertisement
Unity Ads Asset Store Package
Inheritance
Namespace: UnityEngine.Advertisements
Syntax
public static class Advertisement
Properties
debugMode
Controls the amount of logging output from the advertisement system.
Declaration
public static bool debugMode { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
isInitialized
Returns whether the advertisement system is initialized successfully.
Declaration
public static bool isInitialized { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
isShowing
Returns if an advertisement is currently showing.
Declaration
public static bool isShowing { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
isSupported
Returns if the current platform is supported by the advertisement system.
Declaration
public static bool isSupported { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
version
Returns the current Unity Ads version.
Declaration
public static string version { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
AddListener(IUnityAdsListener)
Declaration
public static void AddListener(IUnityAdsListener listener)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityAdsListener | listener |
GetPlacementState()
Returns the state of the default placement.
Declaration
public static PlacementState GetPlacementState()
Returns
| Type | Description |
|---|---|
| PlacementState |
GetPlacementState(String)
Returns the state of specified placement.
Declaration
public static PlacementState GetPlacementState(string placementId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | placementId | Placement identifier. |
Returns
| Type | Description |
|---|---|
| PlacementState |
Initialize(String)
Initializes the advertisement system.
Declaration
public static void Initialize(string gameId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | gameId | Game identifier. |
Initialize(String, Boolean)
Initialize the advertisement system with specified gameId and testMode.
Declaration
public static void Initialize(string gameId, bool testMode)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | gameId | Game identifier. |
| System.Boolean | testMode | Test mode. |
IsReady()
Returns whether an advertisement is ready to be shown for the default placement. Placements are configured per game in the UnityAds admin site, where you can also set your default placement.
Declaration
public static bool IsReady()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsReady(String)
Returns whether an advertisement is ready to be shown for specified placement. Placements are configured per game in the UnityAds admin site.
Declaration
public static bool IsReady(string placementId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | placementId | Placement identifier. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
RemoveListener(IUnityAdsListener)
Declaration
public static void RemoveListener(IUnityAdsListener listener)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityAdsListener | listener |
SetMetaData(MetaData)
Sets various metadata for the advertisement system.
Declaration
public static void SetMetaData(MetaData metaData)
Parameters
| Type | Name | Description |
|---|---|---|
| MetaData | metaData | Metadata container |
Show()
Show the default placement if it is ready.
Declaration
public static void Show()
Show(String)
Show the specified placement if it is ready.
Declaration
public static void Show(string placementId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | placementId | Placement identifier. |
Show(String, ShowOptions)
Show the specified placement if it is ready and returns the result in name="finishCallback".
Declaration
public static void Show(string placementId, ShowOptions showOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | placementId | Placement identifier. |
| ShowOptions | showOptions | Various show options, including resultCallback. |
Show(ShowOptions)
Show the default placement if it is ready and returns the result in name="finishCallback".
Declaration
public static void Show(ShowOptions showOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| ShowOptions | showOptions | Various show options, including resultCallback. |