The whole code looks fine to me, but I am a beginner, so please be patient if it is obvious.
My problem is that I get an error
Object reference not set to an instance of object
ehealth
is the enemy's health and this is for the assignment of a slime's stats
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class EnemyStats : MonoBehaviour
{
public TMP_Text Text;
void Update()
{
string ehealth = GameObject.Find("VStorage").GetComponent<VStorage>().ehealth.ToString();
Text.text = ehealth;
}
}
I don't know what to try so I'm asking for you help. I tried changing some variable names but nothings changed