I have a bullet object that when it collides with an enemy it Instantiates an explosion prefab but when two enemies are on top of each other the method is called twice and spawns two explosions so is there a way to detect multiple enter collisions or call the method once?
Here’s the code for the bullet
public GameObject explosion;
private void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.CompareTag("Enemy"))
{
gameObject.SetActive(false);
EXPLOSION();
}
}