BannerControllerAnchoredAdaptive
Overview
Android-only anchored adaptive banner controller wired to a bannerVisible atom. The sample shows how to compute a safe width and load an anchored adaptive banner at the bottom of the screen.
Platform
- Android only (
#if UNITY_ANDROID).
Atoms / Inputs
- BoolReference
bannerVisible— becomestruewhen the banner loads; setfalseon disable.
Behavior
OnEnable()callsCreateAndLoad()(the sample code is provided but commented out for now).OnDisable()destroys the banner and setsbannerVisible = false.
Anchored Adaptive (sample)
- Compute safe width (dp) with
MobileAds.Utils.GetDeviceSafeWidth(). - Get size with
AdSize.GetCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(widthDp). - Create
BannerViewwith that size atAdPosition.Bottomand wire load/fail events. - Call
LoadAd(new AdRequest()).
Ad Unit
- Uses Google demo ad unit by default. Replace with your real ID for production.