- Home /
Question by
PolymathicIndustries · Dec 25, 2021 at 07:07 PM ·
adssizeheightbanner
Adjusting banner ad size
I have successfully implemented ads, but I cannot manage to find anything about setting the size of banners. My current code that I have used and successfully tried is:
public class BannerAdScript : MonoBehaviour
{
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);
}
}
How do I set the height in a banner ad?
Comment
Your answer
Follow this Question
Related Questions
Tiny Banner Ad problem? 1 Answer
banner ads size 0 Answers
Unity's Google Admob Banner GetHeightInPixels() is inaccurate 0 Answers