AppLovin / AppLovin-MAX-Unity-Plugin

129 stars 35 forks source link

MaxSdk.GetBannerLayout returns wrong dimension in Unity editor #395

Closed kumade closed 5 months ago

kumade commented 5 months ago

MAX Plugin Version

6.5.2

Unity Version

2022.3.22

Device/Platform Info

Unity Editor

Current Behavior

MaxSdk.GetBannerLayout returns Rect.zero when called in Editor. The banner itself is shown with the placeholder Applovin text but the size/position is always Rect.zero for this banner. No errors/warnings in console. Hence I'm unable to test banner positioning on my machine.

Here's the code from Applovin's MaxSDKUnityEditor.cs:

    /// <summary>
    /// The banner position on the screen. When setting the banner position via <see cref="CreateBanner(string, float, float)"/> or <see cref="UpdateBannerPosition(string, float, float)"/>,
    /// the banner is placed within the safe area of the screen. This returns the absolute position of the banner on screen.
    /// </summary>
    /// <param name="adUnitIdentifier">Ad unit identifier of the banner for which to get the position on screen. Must not be null.</param>
    /// <returns>A <see cref="Rect"/> representing the banner position on screen.</returns>

    public static Rect GetBannerLayout(string adUnitIdentifier)
    {
        ValidateAdUnitIdentifier(adUnitIdentifier, "get banner layout");
        return Rect.zero;
    }

It just returns Rect.zero, too bad :)

Expected Behavior

Should return real dimensions.

How to Reproduce

Call MaxSdk.GetBannerLayout on any banner in Unity Editor and look what it returns.

Additional Info

No response

santoshbagadi commented 5 months ago

Hi @kumade , the banners in Unity Editor are mainly for testing callbacks and do not represent the actual size on Android or iOS. So, to test correctly, you would need to build for those specific platforms to make sure that the banners are being sized and positioned correctly.