Assets\Scripts\CountdownText.cs(11,5): error CS0246: The type or namespace name 'Text' could not be

i am getting this error code. Please i need help.

Assets\Scripts\CountdownText.cs(11,5): error CS0246: The type or namespace name ‘Text’ could not be found (are you missing a using directive or an assembly reference?)

ng System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Text))]
public class CountdownText : MonoBehaviour{

public delegate void CountdownFinished();
public static event CountdownFinished OnCountdownFinished;

Text countdown;

void OnEnable() {
countdown = GetComponent();
countdown.text = “3”;
StartCoroutine(“Countdown”);
}

IEnumerator Countdown() {

int count = 3;
for (int i = 0; i < count; i++) {
countdown.text = (count - 1).ToString();
yield return new WaitForSeconds(1);
}

OnCountdownFinished();
}

}

You missed the import/using of the correct namespace. Add this on the top:

using UnityEngine.UI;

1 Like