I have script for Hart counting, when enemy hit player, -1 life etc.
Everything work perfect, Value show on the screen, decreasing like it supposed to.
But in CONSOLE I'm getting this error:
NullReferenceException: Object reference not set to an instance of an object HartCount.Update () (at Assets/Scripts/HartCount.cs:31)
can this stay like that? as everything works etc. but it's kind of annoying to have this error.
public class HartCount : MonoBehaviour
{
public static int HartValue = 10;
Text Hart;
// Use this for initialization
void Start()
{
Hart = GetComponent<Text>();
}
// Update is called once per frame
void Update()
{
Hart.text = "" + HartValue;
}
}