整个代码对我来说看起来不错,但我是初学者,所以如果很明显请耐心等待。
我的问题是我收到错误
未将对象引用设置为对象实例
ehealth
是敌人的生命值,这是为了分配史莱姆的统计数据
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;
}
}
我不知道该尝试什么,所以我请求你的帮助。我尝试更改一些变量名称,但没有任何改变