Q:

Unity AddExplosionForce not doing anything

Recently I've started learning Unity3D. I'm working on a game as an exercise in which you control a space ship and have to dodge asteroids. If you feel like it's getting a bit too much you can hit the space bar, emitting a blast in all directions that repulses nearby asteroids. To create this blast I have the following code:
public class PlayerBlastScript : MonoBehaviour {

public ParticleSystem BlastEffect;

// Update is called once per frame
void Update () {
    if (Input.GetKeyUp(KeyCode.Space)) {
        Fire();
    }
}

public void Fire() {
    ParticleEmitter effect = (ParticleEmitter) Instantiate (BlastEffect, transform.position, Quaternion.identity);
    effect.Emit();

    Vector3 explosionPos = transform.position;
    Collider[] colliders = Physics.OverlapSphere(explosionPos, 25.0f);

    foreach(Collider hit in colliders) {
        if (!hit) {
            continue;
        }

        if (hit.rigidbody) {
            hit.rigidbody.AddExplosionForce(5000.0f, explosionPos, 100.0f);
        }
    }   
}
}

Even though the blast effect appears, the asteroids are not affected at all. The asteroids are all rigid bodies so what's the problem?

A:

You're checking the colliders like they're boolean variables.
If a collider is inside colliders, it should have the explosion effect applied to it, there are no additional collision tests you need to do inside your foreach loop. However, you may want to check the type of object if you don't want things like power ups being affected by the blast effect.
You can change your code to be:
foreach(Collider hit in colliders) {
    hit.rigidbody.AddExplosionForce(5000.0f, explosionPos, 100.0f);
}  

