Hi,
I have recently implemented Unity Ads into my android game, but it does not appear to be working. I have code that checks if and ad is ready, and if it is, enables a button to show an ad. When i launch my game on my device, the button is never enabled. Here is my code:
void Update () {
if(!Advertisement.isInitialized && button == "Revive")
{
Advertisement.Initialize("MY_GAME_ID", true);
}
if(Advertisement.IsReady() && button == "Revive")
{
GetComponent<SpriteRenderer>().enabled = true;
GetComponent<BoxCollider2D>().enabled = true;
}
}
void OnMouseUp()
{
if(button == "Revive")
{
if(Advertisement.IsReady())
{
Advertisement.Show(null, new ShowOptions {
resultCallback = result => {
Debug.Log(result.ToString());
player.GetComponent<PlayerMovement>().revive();
player.transform.position = insPlayer;
gameObject.SetActive(false);
}
});
}
}
}
It works in the editor, but not on my device. Any ideas?
Any help is greatly appreciated, thanks.