Mediation 5.4.0 - Unity C# API Reference Mediation 5.4.0 - Unity C# API Reference
Mediation 5.4.0 - Unity C# API Reference Mediation 5.4.0 - Unity C# API Reference
© 2025 Chartboost, Inc. All rights reserved.

Class BannerAdBase

Base class for all IBannerAd implementations for all platforms.

Inheritance
object
BannerAdBase
BannerAdDefault
Implements
IBannerAd
IAd
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Chartboost.Mediation.Ad.Banner
Assembly: Chartboost.Mediation.dll
Syntax
public abstract class BannerAdBase : IBannerAd, IAd, IDisposable

Constructors

BannerAdBase(IntPtr)

Base constructor for IBannerAd implementations. IntPtr must be present to associate native ad with C# instance.

Declaration
protected BannerAdBase(IntPtr uniqueId)
Parameters
Type Name Description
IntPtr uniqueId

Identifier to associate and track native ads with C# layer.

Fields

BannerAd

Declaration
protected const string BannerAd = "[BannerAd]"
Field Value
Type Description
string

IsDisposed

Tracks validity of placement

Declaration
protected bool IsDisposed
Field Value
Type Description
bool

UniqueId

Unique identifier for this IBannerAd.

Declaration
protected readonly IntPtr UniqueId
Field Value
Type Description
IntPtr

_request

Backing field for BannerAdLoadRequest.

Declaration
protected BannerAdLoadRequest _request
Field Value
Type Description
BannerAdLoadRequest

Properties

BannerSize

Gets the size of the banner ad loaded inside this container. Note that this will change with auto-refresh and will be notified in WillAppear

Declaration
public abstract BannerSize? BannerSize { get; }
Property Value
Type Description
BannerSize?

ContainerSize

Gets or sets the size of the container.

Declaration
public abstract ContainerSize ContainerSize { get; set; }
Property Value
Type Description
ContainerSize

Draggable

Gets or sets a value indicating whether this container can be dragged on the screen.

Declaration
public abstract bool Draggable { get; set; }
Property Value
Type Description
bool

HorizontalAlignment

The horizontal alignment of the ad within its container.

Declaration
public abstract BannerHorizontalAlignment HorizontalAlignment { get; set; }
Property Value
Type Description
BannerHorizontalAlignment

Keywords

The keywords targeted for the ad.

Declaration
public abstract IReadOnlyDictionary<string, string> Keywords { get; set; }
Property Value
Type Description
IReadOnlyDictionary<string, string>

LoadId

The identifier for this load call. Note that this will change with auto-refresh and will be notified in WillAppear

Declaration
public abstract string LoadId { get; }
Property Value
Type Description
string

LoadMetrics

The load metrics for the most recent successful load operation, or Null if a banner is not loaded. If auto-refresh is enabled, this value will change over time. The WillAppear event will be called after this value changes.

Declaration
public abstract Metrics? LoadMetrics { get; }
Property Value
Type Description
Metrics?

PartnerSettings

Optional partner-specific settings that can be associated with the advertisement placement.

Declaration
public abstract IReadOnlyDictionary<string, string> PartnerSettings { get; set; }
Property Value
Type Description
IReadOnlyDictionary<string, string>

Pivot

Gets or sets the Pivot property, which defines the normalized pivot point of this container within the screen coordinate system from which all transformations and layout computations, such as width and height, are based. This property functions similarly to the pivot in Unity's RectTransform

  • X-Axis: Horizontal position within the container, normalized to the container's width. A value of 0 aligns the pivot with the left edge, while a value of 1 aligns with the right edge.
  • Y-Axis: Vertical position within the container, normalized to the container's height. A value of 0 aligns the pivot with the top edge, while a value of 1 aligns with the bottom edge. Examples:
  • (0, 0): Pivot at the top-left corner of the container.
  • (0.5, 0.5): Pivot at the center of the container.
  • (1, 1): Pivot at the bottom-right corner of the container.
Declaration
public abstract Vector2 Pivot { get; set; }
Property Value
Type Description
Vector2

Position

The position of the Pivot of this container on the screen in the Screen Coordinate System. X-Axis: The horizontal axis, with positive values increasing to the right. Y-Axis: The vertical axis, with positive values increasing downward.

Declaration
public abstract Vector2 Position { get; set; }
Property Value
Type Description
Vector2

Request

The publisher supplied request that was used to load the ad.

Declaration
public abstract BannerAdLoadRequest Request { get; }
Property Value
Type Description
BannerAdLoadRequest

VerticalAlignment

The vertical alignment of the ad within its container.

Declaration
public abstract BannerVerticalAlignment VerticalAlignment { get; set; }
Property Value
Type Description
BannerVerticalAlignment

Visible

Gets or sets a value indicating the visibility of the container.

Declaration
public abstract bool Visible { get; set; }
Property Value
Type Description
bool

WinningBidInfo

The winning bid info for the ad. Note that this will change with auto-refresh and will be notified in WillAppear

Declaration
public abstract BidInfo? WinningBidInfo { get; }
Property Value
Type Description
BidInfo?

Methods

Dispose()

Disposes the ad along with its container. This should be called when the ad is no longer needed.

Declaration
public void Dispose()

Dispose(bool)

Declaration
protected abstract void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing

~BannerAdBase()

Declaration
protected ~BannerAdBase()

Load(BannerAdLoadRequest)

Loads an ad.

Declaration
public virtual Task<BannerAdLoadResult> Load(BannerAdLoadRequest request)
Parameters
Type Name Description
BannerAdLoadRequest request

The ChartboostMediationBannerAdLoadRequest request

Returns
Type Description
Task<BannerAdLoadResult>

Reset()

Clears the loaded ad

Declaration
public virtual void Reset()

Events

DidBeginDrag

Called when the ad container has begun dragging on screen.

Declaration
public event BannerAdDragEvent DidBeginDrag
Event Type
Type Description
BannerAdDragEvent

DidClick

Called when the ad executes its click-through. This may happen multiple times for the same ad.

Declaration
public event BannerAdEvent DidClick
Event Type
Type Description
BannerAdEvent

DidDrag

Called when the ad container is dragged on screen.

Declaration
public event BannerAdDragEvent DidDrag
Event Type
Type Description
BannerAdDragEvent

DidEndDrag

Called when the ad container has finished dragging on screen.

Declaration
public event BannerAdDragEvent DidEndDrag
Event Type
Type Description
BannerAdDragEvent

DidRecordImpression

Called when the ad impression occurs.

Declaration
public event BannerAdEvent DidRecordImpression
Event Type
Type Description
BannerAdEvent

WillAppear

Called when ad is loaded within its container. This will be called for each refresh when auto-refresh is enabled.

Declaration
public event BannerAdEvent WillAppear
Event Type
Type Description
BannerAdEvent

Implements

IBannerAd
IAd
IDisposable