Get all Objects from a Physics.OverlapSphere with Name X

heyhey. i wanna apply an explosion force to all objects in a Physics.OverlapSphere with the name “X”. so my script snippet looks like this now:

Vector3 explosionPos = transform.position;
		Collider[] colliders = Physics.OverlapSphere(explosionPos, radius);
		foreach (Collider hit in colliders) {
			Rigidbody rb = hit.GetComponent<Rigidbody> ();

			rayhits.Add (hit.GetComponent<Collider>().gameObject);

			//Add force to nearby rigidbodies
			if (rb != null)
				rb.AddExplosionForce (power, explosionPos, radius, 3.0F);



		}

in there you can see that all “rayhits” with the component collider gets added to a list. all i wanna do now is to sort out all the other colliders and just add the one with the name “X” to that list.

One approach would be changing this:

         rayhits.Add (hit.GetComponent<Collider>().gameObject);

to this:

Collider col = hit.GetComponent<Collider>();
if(col.gameObject.name.Equals("X")) {
   rayhits.Add (col.gameObject);
}