Place this on an empty game object and it should give you every object in the blastRadius in order of closest first, needs altering to suit your requirements, amount, distance … ect.
#pragma strict
var myArray : String[] = new String[200];
var blastRadius : float = 100;
private var i : int;
function Start () {
AreaDamageEnemies(transform.position, blastRadius);
}
function Update () {
}
function AreaDamageEnemies(location : Vector3, radius : int){
var objectsInRange : Collider[] = Physics.OverlapSphere(location, radius);
for (var col : Collider in objectsInRange){
while(i < objectsInRange.length){ // Go through the objectsInRange array (objects in the Physics.OverlapSphere radius)
myArray _= objectsInRange*.name; // Add each GameObject.name to myArray*_