Help Physics.OverlapSphere

Hello, I been looking for hours the next problems, let me explain. I’m following a tutorial from
Brackeys to create a Tower Defense game. The problem comes next, creating the area damage of the Misile Launcher, in the video shows correctly how to do it with Physics.OverlapSphere.
I have the same structure, everything the same but when I play the game the “Enemy” TAG doesn’t get destroyed, looks like the code never gets in to destroy target. Help please

 void HitTarget() {
        GameObject effectIns = (GameObject)Instantiate(impactEffect, transform.position, transform.rotation);
        Destroy(effectIns, 2f);

        if (explosionRadius > 0f)
        {   
            Explode();
        }
        else
        {
            Damage(target);
        }
  
        Destroy(gameObject);
    }

    void Explode()
    {
        Collider[] colliders = Physics.OverlapSphere(transform.position, explosionRadius);
        foreach (Collider collider in colliders)
        {

            if (collider.tag == "Enemy")
            {
               //Never gets in and due to this the target once gets hit, never dies, Turrets without area damage works perfectly well
                Damage(collider.transform);
            }
        }

    }

    void Damage(Transform enemy)
    {
        //Area damage turret never joins here
        Destroy(enemy.gameObject);
    }

Minute 11:30
[

](http:// https://www.youtube.com/watch?v=LJLWNnqAjQ4)

make sure you carefully check code and settings change in editor, we can not do this for you.

Do your enemies have the tag of Enemy attached to them?

Found the solution looking after a day, my prefab was missing a sphere collider, so for that reason the Collider[ ] colliders wasn’t working correctly. Just adding a simple Sphere Collider to the prefab and got it. :slight_smile:

Good job! As you gain experience with Unity you’ll make the same mistakes less (you’ll remember to check tags, or colliders or whatever really) :slight_smile: