это мой код. Я следовал учебнику о том, как сделать бар здоровья. теперь я просто получаю это сообщение об ошибке: Не удалось найти тип или имя пространства имен 'HealthBar' (отсутствует директива using или ссылка на сборку?)
вот мой код
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Player : MonoBehaviour
{
// Start is called before the first frame update
public int maxHealth = 100;
public int currentHealth;
public HealthBar healthBar;
// Start is called before the first frame update
void Start()
{
currentHealth = maxHealth;
healthBar.SetMaxHealth(maxHealth);
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
TakeDamage(20);
}
}
void TakeDamage(int damage)
{
currentHealth -= damage;
healthBar.SetHealth(currentHealth);
}
}