Hi,i don’t know how to do, after i press the play button in main menu, then its shows like a start screen that counts
3, 2, 1, Go… and then start the game ?
Hi,i don’t know how to do, after i press the play button in main menu, then its shows like a start screen that counts
3, 2, 1, Go… and then start the game ?
Something like this:
string countdownText = "";
void OnGUI()
{
if (countdownText != "")
GUI.Label(new Rect((Screen.width - 100) / 2, (Screen.height - 30) / 2, 100, 30), countdownText);
else
if(GUI.Button(new Rect(10, 10, 100, 30), "Play"))
StartCoroutine(Countdown());
}
IEnumerator Countdown()
{
countdownText = "3";
yield return new WaitForSeconds(1);
countdownText = "2";
yield return new WaitForSeconds(1);
countdownText = "1";
yield return new WaitForSeconds(1);
countdownText = "0";
yield return new WaitForSeconds(1);
countdownText = "Go!!!";
yield return new WaitForSeconds(1);
countdownText = "";
}
UPD: Also you could make the same thing, but with a little bit more dramatic fadings of screen, with my Screen Fader solution
Thanks a lot ,its works fine…