Hi,
I recently publish a beta version of my game to test google services and ads before to publish my final app. It’s my first game.
The google services it’s ok. -
But I have some problems with Unity Ads. ://
On Editor:
Appear an image with one message. (Here would be your ad Unit (things seems to be working!))
“Yaha! It’s working” I thought.
On Android device:
…nothing…
“No…No no…nOOOOu” I thought crying kkkk
My code:
using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;
public class <AdScript> : MonoBehaviour {
[SerializeField] string gameID = "GameID";
void Awake () {
Advertisement.Initialize (gameID, true);
}
public void ShowAd(string zone = ""){
#if UNITY_EDITOR
StartCoroutine (WaitForAd ());
#endif
if(string.Equals (zone, ""))
zone = null;
ShowOptions options = new ShowOptions ();
options.resultCallback = AdCallbackhandler;
if (Advertisement.IsReady(zone))
Advertisement.Show (zone, options);
}
void AdCallbackhandler(ShowResult showResult){
switch (showResult) {
case ShowResult.Finished:
Debug.Log ("Ad finished...Take your reward!");
break;
case ShowResult.Skipped:
Debug.Log ("Oh no...:/");
break;
case ShowResult.Failed:
Debug.Log ("Sorry. Don't happen again.");
break;
}
}
IEnumerator WaitForAd(){
float currentTimeScale = Time.timeScale;
Time.timeScale = 0f;
yield return null;
while(Advertisement.isShowing)
yield return null;
Time.timeScale = currentTimeScale;
}
}
Help me?