Countdown timer for starting game
hey guys. i know there are a lot of questions about timers however i cant see answer for my question. i want to countdown from 3 to starting game but i cant handle that.
using System.Collections;
using UnityEngine.UI;
using UnityEngine;
using UnityEngine.SceneManagement;
public class StartGame : MonoBehaviour {
public float timeLeft = 3.0f;
public Text startText;
void Update()
{
timeLeft -= Time.deltaTime;
startText.text = (timeLeft).ToString ("0");
if (timeLeft < 0) {
SceneManager.LoadScene ("game");
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Need thinking event, during time it takes to smtpserver.send 0 Answers
Start and Stop Timer Help 1 Answer
Player Countdown Interaction/Time Reduction+Addition 0 Answers
20 minute countdown timer 2 Answers