- Home /
Tiny Banner Ad problem?
I have completed a simple app and I am almost ready to go except for the ads. I have added in my banner script and it works in Test Mode. I have been Googling and searching everywhere for a way to change the height of Unity banner ads, but I could not find anything. I have attached my banner ad code as well as a screenshot of the bottom portion of the device simulator so you can see how tiny the banner shows up as. Can anyone tell me how to set a banner ad's size?
public string gameId = "1234567";
public string placementId = "bannerPlacement";
public bool testMode = true;
[SerializeField] BannerPosition _bannerPosition = BannerPosition.BOTTOM_CENTER;
void Start()
{
// Initialize the SDK if you haven't already done so:
Advertisement.Initialize(gameId, testMode);
StartCoroutine(ShowBannerWhenReady());
// Set the banner position:
Advertisement.Banner.SetPosition(_bannerPosition);
}
IEnumerator ShowBannerWhenReady()
{
while (!Advertisement.IsReady(placementId))
{
yield return new WaitForSeconds(0.5f);
}
Advertisement.Banner.Show(placementId);
}
}
Answer by robinking · May 25 at 11:30 AM
I am having this problem too. I haven't solved it yet but it's related to the Canvas Scaler on your UI Canvas. The banner ad appears to always be displayed with a Scale Factor of 1. So if your project's Canvas Scaler has a Scale Factor higher than 1 (i.e. for any iPhone after the iPhone 3), your banner ad will be reduced in size. I can't find any way to access the Canvas that the banner is displayed on as it doesn't show up in the hierarchy - but hopefully this at least gives you a clue as to what's happening. When you build to a device (I've been building to my iPhone 12 Pro), the test banner displays correctly - it's just annoying for it to display incorrectly in the editor.
Your answer
Follow this Question
Related Questions
How can I make Audience Network's Banner on a separate block not covering my game content? 0 Answers
LeadBolt Ads For Android 1 Answer
Displaying Admob's banner ad in game scene 0 Answers
banner ads size 0 Answers
Adjusting banner ad size 0 Answers