It worked previously, but when I updated another script in the game from using UnityEngine.UI to the newer using UnityEngine.SceneManagement the ‘public Text’ in this script turned red (is not recognised). Even now when I re-write the script from the beginning as soon as I type the word ‘Text’ it shows it’s not recognised. I am very new to programming so any suggestions appreciated?
The Text component is part of the UnityEngine.UI namespace. This is called out in the documentation for Text.
So you need this at the top:
using UnityEngine.UI;
To include the namespace.