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 UnityBannerAd

Unity UI compatible IBannerAd.

Inheritance
object
Object
Component
Behaviour
MonoBehaviour
UnityBannerAd
Implements
IAd
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.Invoke(string, float)
MonoBehaviour.InvokeRepeating(string, float, float)
MonoBehaviour.CancelInvoke(string)
MonoBehaviour.IsInvoking(string)
MonoBehaviour.StartCoroutine(string)
MonoBehaviour.StartCoroutine(string, object)
MonoBehaviour.StartCoroutine(IEnumerator)
MonoBehaviour.StartCoroutine_Auto(IEnumerator)
MonoBehaviour.StopCoroutine(IEnumerator)
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopCoroutine(string)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.print(object)
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent(Type)
Component.GetComponent<T>()
Component.TryGetComponent(Type, out Component)
Component.TryGetComponent<T>(out T)
Component.GetComponent(string)
Component.GetComponentInChildren(Type, bool)
Component.GetComponentInChildren(Type)
Component.GetComponentInChildren<T>(bool)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren(Type, bool)
Component.GetComponentsInChildren(Type)
Component.GetComponentsInChildren<T>(bool)
Component.GetComponentsInChildren<T>(bool, List<T>)
Component.GetComponentsInChildren<T>()
Component.GetComponentsInChildren<T>(List<T>)
Component.GetComponentInParent(Type, bool)
Component.GetComponentInParent(Type)
Component.GetComponentInParent<T>(bool)
Component.GetComponentInParent<T>()
Component.GetComponentsInParent(Type, bool)
Component.GetComponentsInParent(Type)
Component.GetComponentsInParent<T>(bool)
Component.GetComponentsInParent<T>(bool, List<T>)
Component.GetComponentsInParent<T>()
Component.GetComponents(Type)
Component.GetComponents(Type, List<Component>)
Component.GetComponents<T>(List<T>)
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(string)
Component.SendMessageUpwards(string, object, SendMessageOptions)
Component.SendMessageUpwards(string, object)
Component.SendMessageUpwards(string)
Component.SendMessageUpwards(string, SendMessageOptions)
Component.SendMessage(string, object)
Component.SendMessage(string)
Component.SendMessage(string, object, SendMessageOptions)
Component.SendMessage(string, SendMessageOptions)
Component.BroadcastMessage(string, object, SendMessageOptions)
Component.BroadcastMessage(string, object)
Component.BroadcastMessage(string)
Component.BroadcastMessage(string, SendMessageOptions)
Component.transform
Component.gameObject
Component.tag
Object.GetInstanceID()
Object.GetHashCode()
Object.Equals(object)
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, int)
Object.InstantiateAsync<T>(T, int, Transform)
Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
Object.InstantiateAsync<T>(T, InstantiateParameters)
Object.InstantiateAsync<T>(T, int, InstantiateParameters)
Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.InstantiateAsync<T>(T, int, Vector3, Quaternion, InstantiateParameters)
Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, InstantiateParameters)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate(Object, Transform, bool)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Instantiate<T>(T, Transform, bool)
Object.Destroy(Object, float)
Object.Destroy(Object)
Object.DestroyImmediate(Object, bool)
Object.DestroyImmediate(Object)
Object.FindObjectsOfType(Type)
Object.FindObjectsOfType(Type, bool)
Object.FindObjectsByType(Type, FindObjectsSortMode)
Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object, float)
Object.DestroyObject(Object)
Object.FindSceneObjectsOfType(Type)
Object.FindObjectsOfTypeIncludingAssets(Type)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsOfType<T>(bool)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindObjectOfType<T>(bool)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsOfTypeAll(Type)
Object.FindObjectOfType(Type)
Object.FindFirstObjectByType(Type)
Object.FindAnyObjectByType(Type)
Object.FindObjectOfType(Type, bool)
Object.FindFirstObjectByType(Type, FindObjectsInactive)
Object.FindAnyObjectByType(Type, FindObjectsInactive)
Object.name
Object.hideFlags
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: Chartboost.Mediation.Ad.Banner.Unity
Assembly: Chartboost.Mediation.dll
Syntax
[RequireComponent(typeof(RectTransform))]
public class UnityBannerAd : MonoBehaviour, IAd

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 BannerSize? BannerSize { get; }
Property Value
Type Description
BannerSize?

Draggable

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

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

HorizontalAlignment

The horizontal alignment of the ad within its container.

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

Keywords

The keywords targeted for the ad.

Declaration
public 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 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 Metrics? LoadMetrics { get; }
Property Value
Type Description
Metrics?

PartnerSettings

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

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

PlacementName

The placement name for the ad.

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

Request

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

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

VerticalAlignment

The vertical alignment of the ad within its container.

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

WinningBidInfo

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

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

Methods

Load()

Loads an ad inside this GameObject. Uses the size of this GameObject (width and height in pixels) to construct the BannerSize in load request

Declaration
public Task<BannerAdLoadResult> Load()
Returns
Type Description
Task<BannerAdLoadResult>

Load(BannerAdLoadRequest)

Loads an ad.

Declaration
public Task<BannerAdLoadResult> Load(BannerAdLoadRequest loadRequest)
Parameters
Type Name Description
BannerAdLoadRequest loadRequest
Returns
Type Description
Task<BannerAdLoadResult>

OnDestroy()

Declaration
public void OnDestroy()

Reset()

Clears the loaded ad

Declaration
public void Reset()

ToString()

Returns JSON representation of the object

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
Object.ToString()

Events

DidBeginDrag

Called when the ad container has begun dragging on screen.

Declaration
public event UnityBannerAdDragEvent DidBeginDrag
Event Type
Type Description
UnityBannerAdDragEvent
Remarks

Event type is UnityBannerAdDragEvent for Unity UI compatibility.

DidClick

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

Declaration
public event UnityBannerAdEvent DidClick
Event Type
Type Description
UnityBannerAdEvent
Remarks

Event type is UnityBannerAdEvent for Unity UI compatibility.

DidDrag

Called when the ad container is dragged on screen.

Declaration
public event UnityBannerAdDragEvent DidDrag
Event Type
Type Description
UnityBannerAdDragEvent
Remarks

Event type is UnityBannerAdDragEvent for Unity UI compatibility.

DidEndDrag

Called when the ad container has finished dragging on screen.

Declaration
public event UnityBannerAdDragEvent DidEndDrag
Event Type
Type Description
UnityBannerAdDragEvent
Remarks

Event type is UnityBannerAdDragEvent for Unity UI compatibility.

DidRecordImpression

Called when the ad impression occurs.

Declaration
public event UnityBannerAdEvent DidRecordImpression
Event Type
Type Description
UnityBannerAdEvent
Remarks

Event type is UnityBannerAdEvent for Unity UI compatibility.

WillAppear

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

Declaration
public event UnityBannerAdEvent WillAppear
Event Type
Type Description
UnityBannerAdEvent
Remarks

Event type is UnityBannerAdEvent for Unity UI compatibility.

Implements

IAd