ok so basically im making a game wher the player shoots arrows and other projectiles
now when these projectiles enter the game objects collider they destroy themselves and they are also supposed to lower the enemys health. the enemies health is a variable in its script. now how do i do that.
heres what im doing
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag(“Wall”))
{
gameObject.SetActive(false);
}
if (other.CompareTag("Enemy"))
{
other.Health = other.Health - ;
gameObject.SetActive(false);
}