docs.unity3d.com
    Show / Hide Table of Contents

    Class Advertisement

    The wrapper class used to interact with the Unity Ads SDK.

    Inheritance
    Object
    Advertisement
    Namespace: UnityEngine.Advertisements
    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
    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 true to initialize in test mode.

    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 true to initialize in test mode.

    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
    Show(String)

    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 IUnityAdsLoadListener callbacks

    See Also
    Show(String)

    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 IUnityAdsShowListener callbacks

    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 IUnityAdsShowListener callbacks

    Show(ShowOptions)

    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
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023