Destroy within a certain radius?

Hello. When a condition happens, I want to destroy all objects with a certain tag that are within a certain radius of another object immediately, how would I do this? Thank you

There are several ways you could do this. Here is 1 example:

if(condition == true) {
     Collider[] nearObjects = Physics.OverlapSphere(somePosition, radius);
     //Return an array of all the colliders within a certain radius of some obj.

     foreach (Collider object in nearObjects) {
     //Iterate through the array

          if(object.tag == someTag) //Does the object have a certain tag.
              //If yes, then Destroy the gameObject the collider is attached to


Or you could use Vector3.Distance. It would work very similarly, but you would first find an array of all the tagged objects, then check their distance from a desired point. The biggest advantage to this method would be that you don't have to have a collider attached to each object.