it write this message and I don’t know what is the problem
this is what is in my console :Tag: Bullet is not defined. UnityEngine.StackTraceUtility:ExtractStackTrace () healthscript:OnCollisionEnter2D (UnityEngine.Collision2D
here is the code
public class healthscript : MonoBehaviour {
public string bulletTag = "Bullet";
public HealthBar healthBar;
public int maxHealth = 100;
public int currentHealth;
// Start is called before the first frame update
void Start()
{
currentHealth = maxHealth;
healthBar.SetMaxHealth(maxHealth);
}
void OnCollisionEnter2D(Collision2D collision)
{
// Check if the object we collided with has the "Bullet" tag
if (collision.gameObject.CompareTag("bulletTag"))
{
TakeDamage(20);
}
}
void TakeDamage(int damage)
{
currentHealth -= damage;
healthBar.SetHealth(currentHealth);
}
}