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!
↧