Need some help with 2D combat (example video)

Hi there,

I’m using Physics2D.OverlapCircleAll for 2D combat detection and I’m getting some inconsistent results with my player to enemy hit detection as illustrated in this short video clip here:

Any ideas why this is happening? The code is fairly simple, when I hit a button an Attack() function is called. Thanks in advance for checking this out.

I think it’s just because of the radius of the overlap circle. By the time the animation executes, the overlap circle already disappears. You could use a trigger collider in front of the player and keep all enemies in a list which are inside the collider via OnTriggerEnter2D and OnTriggerExit2D and try to apply the damage until the animation finishes, or you can increase the radius of the overlap circle, or position the circle better.