Unity Ads are working fine on iOS but not working on Android. Then I found “System.Action’1[UnityEngine.Advertisements.ShowResults]” comes when i click on show ads button as a text in Android and ads are not playing.
What to do please help.
Thanks
Unity Ads are working fine on iOS but not working on Android. Then I found “System.Action’1[UnityEngine.Advertisements.ShowResults]” comes when i click on show ads button as a text in Android and ads are not playing.
What to do please help.
Thanks
What was the ShowResult value of the result passed to the ShowResult delegate?
Might be helpful seeing your integration code if this is error message.
Here is my code :
public Text test;
#ifUNITY_IPHONE
[SerializeField] string gameID = “36122”;
#elifUNITY_ANDROID
[SerializeField] string gameID = “40859”;
#endif
voidAwake()
{
Advertisement.Initialize (gameID, true);
test.text = “Ad Init”;
}
publicvoidShowAd(stringzone = “”)
{
#ifUNITY_EDITOR
StartCoroutine(WaitForAd ());
#endif
if (string.Equals (zone, “”)) {
zone = null;
test.text = “zone null”;
}
ShowOptionsoptions = newShowOptions ();
options.resultCallback = AdCallbackhandler;
test.text = options.resultCallback.ToString ();
if (Advertisement.isReady (zone))
Advertisement.Show (zone, options);
}
voidAdCallbackhandler (ShowResultresult)
{
switch(result)
{
caseShowResult.Finished:
Debug.Log (“Ad Finished. Rewarding player…”);
intx = PlayerPrefs.GetInt(“LandMinesCount”);
print("Landmine : "+x);
x = x + 2;
PlayerPrefs.SetInt(“LandMinesCount”,x);
test.text = “Ad Finished”;
break;
caseShowResult.Skipped:
Debug.Log (“Ad skipped. Son, I am dissapointed in you”);
test.text = “Ad skip”;
break;
caseShowResult.Failed:
Debug.Log(“I swear this has never happened to me before”);
test.text = “Ad failed”;
break;
}
}
IEnumeratorWaitForAd()
{
floatcurrentTimeScale = Time.timeScale;
Time.timeScale = 0f;
yieldreturnnull;
while (Advertisement.isShowing)
yieldreturnnull;
Time.timeScale = currentTimeScale;
}