My code is not working. The timer only works when I removed the if statement on the start function there.
void Start()
{
if (uiPanel.activeInHierarchy == false)
{
StartCoroutine(Countdown());
}
}
IEnumerator Countdown()
{
while (countdownTime > 0)
{
countdownText.text = countdownTime.ToString();
yield return new WaitForSeconds(1f);
countdownTime--;
}
countdownText.gameObject.SetActive(false);
}