- Home /
Question by
UrMomDerpThanoFish · Nov 26, 2019 at 05:18 PM ·
error
Why do i keep getting this error?
My error is "Assets\Scripts\Enemy\EnemyHealth.cs(7,30): error CS0246: The type or namespace name 'EnemyStats' could not be found (are you missing a using directive or an assembly reference?)" It is on line 7 of my script.
My Script is
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class EnemyHealth : MonoBehaviour, IDamageable { [SerializeField] private EnemyStats enemyStats;
private int currentHealth;
private void Start()
{
currentHealth = enemyStats.maxHealth;
}
public void DealDamage(int damage)
{
currentHealth -= damage;
CheckIfDead();
}
private void CheckIfDead()
{
if(currentHealth <= 0)
{
Destroy(gameObject);
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612215334im_/https://answers.unity.com/themes/thub/images/avi.jpg)