- Home /
Question by
Eagle-Bound · Oct 03, 2016 at 09:48 PM ·
c#adsnoobadvertising
Ad not showing up in test mode
So I did some looking around and found a couple of good videos on ads in Unity, but whenever I tried them it didn't work. I don't get an error, just nothing shows up. My code:
void Awake(){
if (Advertisement.isSupported) {
if (Application.platform == RuntimePlatform.Android) {
Advertisement.Initialize("0000000", false);
}
else if (Application.platform == RuntimePlatform.IPhonePlayer) {
Advertisement.Initialize("0000000", false);
}
}
}
else {
Debug.Log ("Wrong");
incorrect.Play ();
gameActive = false;
Debug.Log ("ad");
if(Advertisement.IsReady()){
var options = new ShowOptions { resultCallback = HandleShowResult };
Advertisement.Show (null, options);
}
}
}
private void HandleShowResult(ShowResult result){
switch(result) {
case ShowResult.Finished:
Debug.Log("stuff");
break;
case ShowResult.Skipped:
Debug.Log ("no stuff");
break;
case ShowResult.Failed:
Debug.Log ("rip");
break;
}
}
}
In my script, there are actual numbers in the awake function, but I don't think its a good idea to put them online.
Thanks!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612093939im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can't hide ads 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
OnUnityAdsShowComplete not working 2 Answers