Could someone post a working script for calculating the Smart Banner size in pixels?
I want to place a banner at the bottom of the screen and rearrange my UI layout based on the banner's height.
I come up with the following code after reading the Admob guide and looking into other sources, but it's not giving the correct height when testing on some devices.
int CalculateBannerHeight() {
if (Screen.height <= 400*Screen.dpi/160) {
return Mathf.RoundToInt(32*Screen.dpi/160);
} else if (Screen.height <= 720*Screen.dpi/160) {
return Mathf.RoundToInt(50*Screen.dpi/160);
} else {
return Mathf.RoundToInt(90*Screen.dpi/160);
}
}