Question by
mavs30003 · Sep 29, 2016 at 12:01 PM ·
timerscene load
How change Scene when countdown is finished?
I have this:
void Start () {
tiempo = 10;
}
// Update is called once per frame
void Update () {
tiempo -= Time.deltaTime;
tiempo_boton.text = "" + tiempo.ToString ("F0");
}
public void vuelta_a_diez(){
tiempo = 10;
if (tiempo == 0)
SceneManager.LoadScene ("FinDelJuego");
}
}
I need that when my time is finished ( time = 0) change Scene. this is correct??
Comment
Best Answer
Answer by Hellium · Sep 29, 2016 at 12:04 PM
Here is my solution (I hven't tested it though)
private float tiempo ;
void Start ()
{
tiempo = 10;
}
void Update ()
{
if( tiempo > 0 )
{
tiempo -= Time.deltaTime;
tiempo_boton.text = "" + tiempo.ToString ("F0") ;
if( tiempo <= 0 )
SceneManager.LoadScene ("FinDelJuego");
}
}
Your answer
Follow this Question
Related Questions
Getting a timer to go to 0 1 Answer
Capture Zone Timer 0 Answers
How do I add my Timer to my Score system in C# ? 0 Answers
Time accuracy using .NET Stopwatch class on IOS 0 Answers
How to make GameOve Appear when times'up in unity? 0 Answers