Why does UnityAds crash my game after I close the ad?
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.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612100202im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity compilation error even when VS compiles fine 0 Answers
My App crashes when I use the correct Game's Ads ID 0 Answers
Editor crashes immediately 0 Answers
Unity 2020.1 changing Script triggers complete reimport? 0 Answers
Why does my game crash on my mobile when I try to load the scene with this interstitial ad script? 0 Answers