I am trying to use Unity ADS but is not working.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
#if UNITY_ADS
using UnityEngine.Advertisements;
#endif
void Start()
{
//Advertisement.Initialize(gameId);
#if UNITY_ADS
Advertisement.Initialize(gameId, enableTestMode);
#endif
//StartCoroutine(ShowAd());
}
public void ShowAD(bool reward)
{
if (reward)
{
ShowRewardedAd();
}
else
{
if (PlayerPrefs.GetInt("canShowAllADS") == 0)
ShowAds();
}
}
private void ShowAds()
{
Debug.Log("call ADS");
#if UNITY_ADS
while (!Advertisement.IsReady())
{
Debug.Log("ADS NOT READY YET");
}
Advertisement.Show();
Debug.Log("worked");
#else
Debug.Log("failed");
#endif
}
when I call "showads" it wont work on mobile neither on editor (the test sample one)
Can somebody help me?
I already have a unityADS account and the gameid is right. Also I'm using test mode.
Thank you
↧