Change position of AdMob banner when opening new scene
Hi, Like subject says, is there a way to change position of AdMob banner when opening new scene? For example, its an Android game and position of banner in Menu scene is at left-bottom, but when I load Game scene (other scene) I want banner to be at bottom position. Is that possible? I tried bunch of things but no luck. Thanks in advance!
Answer by romatallinn · Oct 29, 2016 at 02:00 PM
Try find out something about AdPosition. Maybe you could change it as you like according to scene changes.
For example, when scene is changed, you destroy old ad instance and create a new one with desired position.
BannerView bannerView = new BannerView(adUnitId, adSize, AdPosition.Bottom);
Answer by gzervop · Nov 24, 2021 at 11:45 AM
Best practise is to not destroy an ad but let admob do its things, so if you want to change position dependig on the case use the following.
this.bannerView.SetPosition( AdPosition.Top);
Answer by stevendale · Oct 29, 2016 at 02:21 PM
Thanks for answer! Ok, so I have to destroy old one and create new one? Would that change, for example, load totally new ad (wont show ad that was at Menu scene)?
@stevendale does it matter for you? The new ad instance may show the same ad as it was at the previous scene, but also it may show another one.
I am not sure whether you have to destroy old one or not. $$anonymous$$aybe you could just change the position by accessing to BanerView's variable. Try to find any variable inside bannerView.something that is similar to AdPosition or just position. I just don't know.
I tried to google your problem and found out something similar here. So, I've concluded that you need to recreate ad instance.
@romatallinn sorry for late apply. Once again, thank you very much for your time and effort! Doesnt matter for me at all but does it effects Ad$$anonymous$$ob in any way, like revenue or something? I tried bunch of things with bools and statements on AdPositon but banner always stays at position that is loaded on first scene. I guess that only solution is by destroying and recreating ad instance.
@stevendale could you please accept my answer if it helped you :)