Hello folks.
Unity Ads was working just fine on my game (on both android and the editor), but I went on to test it today and it suddenly stopped working, despite the fact that I didn’t touch the code responsible for showing the ads in the first place. Can someone please help ?
Here’s the code I’m using to show the ads. Like I said, it was working just fine until today. The code is located in a script attached to a button.
ublic class ShowAdvertisement : MonoBehaviour {
bool hasShown;
private Text text;
public GameObject AdText;
public bool developmentBuild;
void Awake(){
hasShown = false;
text = GetComponent<Text> ();
}
public void ShowAd(){
if (!hasShown) {
if (Advertisement.isSupported) {
Advertisement.allowPrecache = true;
Advertisement.Initialize ("49044", developmentBuild);
}
Advertisement.Show (null, new ShowOptions{pause = true, resultCallback = result =>{}});
hasShown = true;
transform.GetChild(0).GetComponent<Text>().text = "You Watched the Ad";
GameController.control.AddMoney(20);
AdText.GetComponent<PlayerMoneyDisplay>().initMoney = GameController.control.currentMoney;
} else {
transform.GetChild(0).GetComponent<Text>().text = "You Watched the Ad";
}
}
// Use this for initialization
}