OnTriggerEnter2D triggers same code multiple times concurrently, should only do so sequentially

The basic setup:

A bullet with a trigger collider, which upon hitting an enemy, starts some code to check for piercing, inflicting damage, etc.

But when there is a heap of enemies, OnTriggerEnter2D is, for obvious reasons, being called multiple times in the same frame, which I haven’t even been able to circumvent with a bool isCollidingWithEnemy.

Anyone got a suggestion?

Thanks in advance, Leslie

You could add a bool hasCollided = false; property to each bullet. The first time it collides, it sets this property to true. If this property is already true, then exit with return and don’t execute the rest of the code.