Class UnityBannerAd
Unity UI compatible IBannerAd.
Implements
Inherited Members
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
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.