- Home /
Best way to delay the GameOver screen?
When the player crashes, I want to display the game over screen. Everything works fine in the original version, but now I want to delay the appearance of the Retry/Exit buttons for about 3 seconds. I also have the need to insert a call to show an interstitial ad between when the retry/exit buttons appear and the game ends. This is what I thought would work, but the buttons do not enable. I'm not worried about the advertisement call working yet, as I cannot seem to get WaitForSeconds to do anything yet on the second call.
Is there a better way to do this? If I use StartCoroutine in ShowGameOverScreen(), it doesn't get called. Also, if I use interactable on the Buttons, the text is still visible, does that require a second property change for just the text?
public IEnumerator ShowGameOverScreen ()
{
gameOverScreen.SetActive (true);
yield return new WaitForSeconds (1.0f);
if (adFreeVersion)
AdmobVNTIS_Interstitial._showInterstitialImmediately ();
yield return new WaitForSeconds (3.0f);
buttonExit.interactable = true;
buttonRetry.interactable = true;
}
I'm not familiar with the Ad$$anonymous$$ob thing, but is there any chance it sets the timescale to 0? Just thought that might be a possibility since ads usually pause games.
Don't know if you are using some plugin for admob but its xCode implementation pauses the UnityActivity on the device. so if the same happens through this plugin the 3 second countdown will start AFTER the ad is dismissed.
Your answer
Follow this Question
Related Questions
Using a 3D model as a button, in Unity's UI system? 3 Answers
Invoke a Coroutine From OnCollisionEnter 1 Answer
Problem with a button 2 Answers