Unity Banner Configuration

1. Set Up the Banner Ad Delegate Method

Yodo1U3dMas.SetBannerAdDelegate((Yodo1U3dAdEvent adEvent, Yodo1U3dAdError error) => {
    Debug.Log("[Yodo1 Mas] BannerdDelegate:" + adEvent.ToString() + "\n" + error.ToString());
    switch (adEvent)
    {
        case Yodo1U3dAdEvent.AdClosed:
            Debug.Log("[Yodo1 Mas] Banner ad has been closed.");
            break;
        case Yodo1U3dAdEvent.AdOpened:
            Debug.Log("[Yodo1 Mas] Banner ad has been shown.");
            break;
        case Yodo1U3dAdEvent.AdError:
            Debug.Log("[Yodo1 Mas] Banner ad error, " + error.ToString());
            break;
    }
});


2. Show Banner Ad

The method using the default parameters, align: Yodo1U3dBannerAlign.BannerBottom | Yodo1U3dBannerAlign.BannerHorizontalCenterand offset (X: 0,Y: 0)

Yodo1U3dMas.ShowBannerAd();

3. Set Banner Position

You can choose the banner position (bottom or top) by creating an in variable in the following way:

//for banner on bottom
int align = Yodo1U3dBannerAlign.BannerBottom;
//for banner on top
int align = Yodo1U3dBannerAlign.BannerTop;

Yodo1U3dMas.ShowBannerAd(align);

4. Set Banner Offset

You can customize the banner offset for avoid notch or camera holes for example using the next code:

int align = Yodo1U3dBannerAlign.BannerTop | Yodo1U3dBannerAlign.BannerHorizontalCenter;
int offsetX = 10;
int offsetY = 10;
Yodo1U3dMas.ShowBannerAd(align, offsetX, offsetY);

5. Dismiss Banner

Yodo1U3dMas.DismissBannerAd();

6. Create a Banner Placement

Simply add the placement name as a string after the positioning and offset.

Yodo1U3dMas.ShowBannerAd("Placement_Name");

Updated on August 30, 2021

Was this article helpful?

Related Articles