\$\begingroup\$

I have a object with box collider that spins 360 degree before destroying itself. I have a lot of enemies spawning around the player. The object spawns, spins and destroys itself. Imagine it like scythe. But only some enemies are getting damaged and some are not. The code is given below

 private void OnTriggerEnter2D(Collider2D collision)
 {
     damage(collision.gameObject);
 }

 void damage(GameObject other)
 {
     if (other.gameObject.CompareTag("Enemies"))
     {
         //Damaging the enemy
         other.gameObject.GetComponent<Health_Enemy>().health -= Damage;
         other.gameObject.GetComponent<Health_Enemy>().check();
     }
 }
```

\$\endgroup\$

You must log in to answer this question.