I've recently finished an app and I am trying to implement UnityAds. Though, whenever I close the ad, my game crashes. This issue occurs in both the unity editor and my test build. Here are the only parts of my script that use UnityAd Functionalities:
public void ShowAd(){
if (Advertisement.IsReady ()) {
Advertisement.Show ("",new ShowOptions(){resultCallback = HandleAdCall});
}
adCounter = 0;
}
private void HandleAdCall(ShowResult result){
switch (result) {
case ShowResult.Finished:
bonus = true;
Time.timeScale = start;
break;
case ShowResult.Skipped:
bonus = false;
Time.timeScale = start;
break;
case ShowResult.Failed:
Debug.log("Failed to load video!");
break;
}
}
void Death(){
adCounter++;
if (adCounter == 4) {
ShowAd ();
}
dead = true;
GamePause(pause);
}
}
Note: Whenever the player dies, the Death() function is called and the Time.timescale is set to 0.00001f by calling the GamePause() function.
↧