How to get an object if it touches another object?

I am making a game and in it the player can attack enemies. I’m using:


to find if there is an enemy in front of the character however I need to know WHICH enemy is in his range of attack so I can execute the death sequence on the proper enemy. How would one do that? I was thinking about using OnCollisionEnter() but I couldn’t figure it out altogether much less figure out how to find what is colliding with it. Thank you for any answers!

The return type of OverlapCircle is a Collider2D.

So you could use:

Collider2D hitTarget = Physics2D.OverlapCircle(EnemyCheck.position,0.4,whatIsEnemy);
Destroy (hitTarget.gameObject);