Okay, so one way is to destroy/deactivate them. When a bullet hits something, simply destroy/deactivate it.
Downside: The bullet is “gone”, it won’t be there for visualization unless you disable or remove its collider, but then, it won’t react to any physics anymore.
Next option, you can change their Layer. A layer (top of the object in the inspector) can be used to configure physics interactability. For instance, you can say that LayerA shoul completely ignore LayerB objects (basically a less granular thing to your approach, which attempted to register individual pairs of colliders).
Anyway, you can use layers and move the objects to a different layer, for instance “IgnoreDamagables” layer.
Downside: If you have piercing bullets, this will turn out to be inconvenient and leads to a mess.
So, at this point, your approach is still a better one.
Using your approach, you would not pass the array to the method, but any bullet’s collider that enters the trigger. It’s a tiny change in your code. Instead of passing the array, you should be able to do
Physics2D.IgnoreCollision(collider, PCol, true);
(Note: I renamed collision paramter to collider as it was part of your snippet. This can be confusing as there is also a Collision class, which is used during OnCollisionXYZ, whereas OnTriggerXYZ uses Colliders.
This line of code does not require pre-known bullets (as in your public and serialized BCol array). With the other lines of code in your snippet, it’d filter bullets by their tag, and then ignore the bullets collider, which comes in as the argument.
I’m not entirely sure how much overhead this generates. Thinking about it, the registration should simply prevent the OnTrigger message from being sent to the objects if the registered collider mappings happen to define a physical interaction, though that’s not obvious.
However, you can also roll your own small tracking system. For instance, keep track of whether something has been hit or not.