docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class BannerAd

    Class to be instantiated in order to show a Banner Ad.

    Inheritance
    object
    BannerAd
    Implements
    IBannerAd
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Services.Mediation
    Assembly: Unity.Mediation.dll
    Syntax
    public sealed class BannerAd : IBannerAd, IDisposable

    Constructors

    BannerAd(string, BannerAdSize, BannerAdAnchor, Vector2)

    Constructor for managing a specific Banner Ad.

    Declaration
    public BannerAd(string adUnitId, BannerAdSize size, BannerAdAnchor anchor = BannerAdAnchor.Default, Vector2 positionOffset = default)
    Parameters
    Type Name Description
    string adUnitId

    Unique Id for the Ad you want to show.

    BannerAdSize size

    Size of banner set to be constructed.

    BannerAdAnchor anchor

    Anchor on which the banner position is based

    Vector2 positionOffset

    The X, Y coordinates offsets, relative to the anchor point

    Properties

    AdState

    Get the current state of the ad.

    Declaration
    public AdState AdState { get; }
    Property Value
    Type Description
    AdState

    AdUnitId

    Get the ad unit id set during construction.

    Declaration
    public string AdUnitId { get; }
    Property Value
    Type Description
    string

    Size

    Get the banner size set during construction.

    Declaration
    public BannerAdSize Size { get; }
    Property Value
    Type Description
    BannerAdSize

    Methods

    Dispose()

    Dispose and release internal resources.

    Declaration
    public void Dispose()

    LoadAsync()

    Method to tell the Mediation SDK to load an Ad.

    Declaration
    public Task LoadAsync()
    Returns
    Type Description
    Task

    Async Load task

    Exceptions
    Type Condition
    LoadFailedException

    Thrown when the ad failed to load

    SetPosition(BannerAdAnchor, Vector2)

    Sets the position of a banner ad.

    Declaration
    public void SetPosition(BannerAdAnchor anchor, Vector2 positionOffset = default)
    Parameters
    Type Name Description
    BannerAdAnchor anchor

    Anchor on which the banner position is based

    Vector2 positionOffset

    The X, Y coordinates offsets, relative to the anchor point

    Events

    OnClicked

    Event to be triggered by the adapter when the user clicks on the Ad.

    Declaration
    public event EventHandler OnClicked
    Event Type
    Type Description
    EventHandler

    OnFailedLoad

    Event to be triggered by the adapter when an Ad fails to load.

    Declaration
    public event EventHandler<LoadErrorEventArgs> OnFailedLoad
    Event Type
    Type Description
    EventHandler<LoadErrorEventArgs>

    OnLoaded

    Event to be triggered by the adapter when an Ad is loaded.

    Declaration
    public event EventHandler OnLoaded
    Event Type
    Type Description
    EventHandler

    OnRefreshed

    Event to be triggered by the adapter when the Ad refreshes

    Declaration
    public event EventHandler<LoadErrorEventArgs> OnRefreshed
    Event Type
    Type Description
    EventHandler<LoadErrorEventArgs>

    Implements

    IBannerAd
    IDisposable
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)