Game is when the player collides with an enemy object they score a point. I think my logic is correct but I have no idea why it is not working. I made a canvas with Text as a child and attached this script to it. It is giving me an error at the public Text scoreText line, saying ’ The type or namespace name ‘Text’ could not be found (are you missing a using directive or an assembly reference?)'. Now I thought make a reference to the Text component would suffice but it is not working. Could someone please shed some light on this?
public class Score : MonoBehaviour
{
public GameObject player;
public Text scoreText;
void OnTriggerEnter()
{
if (player.collision.tag == "enemy")
{
scoreText.text += 1;
}
}
}