I have an int var that stores the number of times the player has died while trying to defeat a boss - it needs to be presented at the end of the fight using text ui but I’m getting these errors: ‘Text’ does not contain a definition for ‘text’ and no accessible extension method ‘text’ accepting a first argument of type ‘Text’ could be found
public Text deathText;
public GameObject boss;
void Update()
{
if (!boss.activeInHierarchy)
{
deathText.text = PlayerController.deaths.ToString();
deathText.text = "Deaths: " + PlayerController.deaths;
}
}
This code resides in my gamemanager script (which, yes, is using UnityEngine.UI) and the variable ‘deaths’ is static which comes from a different script. Another weird thing is that I can’t assign the text in the inspector to the deathText variable, it just stays as “None (Text)”. Just in case the problem was because of the fact that I’m using a variable from a different script, I tried it with a variable from this script and I got the exact same errors.
Any and all feedback/help is appreciated