I can’t figure out how to get Unity Ads working on my android device. They show that they’re working in the editor, but when I click to watch the ad on my device, it doesn’t show up. I’ve tried many things from other threads, but they don’t seem to be working. Here’s the code:
using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;
public class runAdScript : MonoBehaviour {
int delayInt = 30;
int coinsInt = 1000;
int resultInt = 0;
// Use this for initialization
void Start () {
if (Advertisement.isSupported) {
Advertisement.allowPrecache = true;
Advertisement.Initialize ("69217", true);
}
}
void OnMouseUp(){
if (Advertisement.isReady ()) {
Advertisement.Show (null, new ShowOptions {
pause = false,
resultCallback = result => {
switch(result)
{
case (ShowResult.Finished):
resultInt = 2;
delayInt = 0;
break;
case (ShowResult.Failed):
resultInt = 1;
break;
case(ShowResult.Skipped):
resultInt = 1;
break;
}
}
});
}
}
// Update is called once per frame
void Update () {
if (coinsInt > 0){
PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") + 5);
coinsInt = coinsInt - 5;
//Animation Purposes
}
}
}