I have 2 scripts: one for bullet and one for enemy. In EnemyController, there are function:
public void TakeDamage(int damage)
{
_health -= damage;
}
and I call it in script for bullet
if (hitInfo.collider.CompareTag("Enemy"))
{
hitInfo.collider.GetComponent<EnemyController>().TakeDamage(damage);
}
Unity says me, that it is error CS0103: The name 'damage' does not exist in the current context.
Why?
2 comments