special ability collision logic

Say you have a smash ability around your character that damages everything in an X radius. Would it be better to have the “smash” trigger collision a child of your player, where the enemies colliding with it just check if you are using the ability, or to spawn the “smash” object with colliders on-top of the player whenever it’s used then destroy it after the ability is done? Or is there a better way? I have tried the first method and it seemed a bit hacky.

Bump

Rather than adding GameObjects, colliders and putting code in callbacks you might be better just performing a single query like Physics2D.OverlapCircle. This way you can perform it whenever you like based upon whatever condition you like (“smash” ability on). Like all queries you can filter what it detects in a lot of ways to only get what you want.

Note you can also have a child GameObject (that has this “smash” script query) positioned at the correct center where you’d like to check the X radius and use the Transform on that child as the center for the above circle query.

Hope this helps.