- Home /
Countdown to start level
Hi there,
I have a script to have the 3.. 2...1 GO!
But the level loads straight away. I want the level to hold all controls until the go has finished. How do i go about doing this? Where about do I put "start level" in the script. Sorry, I'm not a programmer more a designer :3
var Text : GUIText;
private var starttime = false;
function Start()
{
starttime = true;
if (starttime == true)
{
StartCoroutine("CountDown");
}
}
function CountDown()
{
yield WaitForSeconds(1);
Text.text = "3";
yield WaitForSeconds(1);
Text.text = "2";
yield WaitForSeconds(1);
Text.text = "1";
yield WaitForSeconds(1);
Text.text = "GO!";
}
Thank you very much :)
Answer by FL · Feb 10, 2013 at 01:14 AM
The GUI elements need to be in a camera. Add this one in the main camera.
It works perfectly fine :) But i want to hold all the controls until the go is finished if that's able?
You need to set some flag (like the canControl in Standart Assets>Character Controllers>Character$$anonymous$$otor.js) to disable your controller movement before the countdown and enable after the countdown.
Ah, i'm using the Unity car script. So would i go into the Car.js and do it there? Thank you for your help :)
Your answer
Follow this Question
Related Questions
countdown/countup timer 1 Answer
Countdown timer in minutes:seconds:milliseconds 2 Answers
Timer not work :( 0 Answers