- Home /
Game doesnt start after adding Admob
Game doesnt start after adding Admob, in the Unity everything forks fine, but when im building game to android and open it - there just a black screen. Here's my script, which i added to empty GameObject.
using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; using GoogleMobileAds; public class AdBannder : MonoBehaviour { private BannerView bannerView;
public void Start()
{
#if UNITY_ANDROID
string appId = "ca-app-pub-3945473749443628~7640216171";
#elif UNITY_IPHONE
string appId = "ca-app-pub-3940256099942544~1458002511";
#else
string appId = "unexpected_platform";
#endif
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize(appId);
this.RequestBanner();
}
private void RequestBanner()
{
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-3945473749443628/1192736638";
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-3940256099942544/2934735716";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);
}
}
Answer by mansoor090 · Jun 10, 2019 at 10:26 AM
Did you add the app id in Manifest file?
Yes , you have to ..
I guess i am late in replying..
Your answer
![](https://koobas.hobune.stream/wayback/20220612202857im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Why does this make unity crash? 4 Answers
Unity crashing with BroadcastMessage (possibly not thread safe?) 0 Answers
Crash on OpenGL ES 3.0 Device.. 2 Answers