2D explosion that targets specific gameobjects


I’m making a 2D platformer and wanted to ask what is the best way to create a grenade like explosion? Basically a 2D circular area where anything with a specific tag that is within the circular area is destroyed. I’ve been using playmaker for most of the game and to be honest not entirely sure how to solve this via that.

In essence what I’m after is a way that any game object with the tag ‘enemy’ which are within an area has a message sent to it to do something, instead of everything with the tag ‘enemy’ in the level being told to do something (which I did manage through arraymaker).

Note: I’m relatively new to programming in Unity.


I don’t know how to make it via Playmaker, but in C# it’s pretty simple.
Create an overlap sphere at the point of explosion, and gather all the colliders of tag “anytagthatyouwant” in an array,
And then simply loop that array and do whatever you want with them (like adding an ExplosionForce).

A link to Explosion Force,

And a small change to the script for you,
Here you go:

void Start() {
        Vector3 explosionPos = transform.position;
        Collider[] colliders = Physics.OverlapSphere(explosionPos, radius);
        foreach (Collider hit in colliders) {
            if (hit.gameObject.tag =="yourtag" && hit.rigidbody)
                hit.rigidbody.AddExplosionForce(power, explosionPos, radius, 3.0F);