ignore collision when bool false?

Is there a way to ignore collision with 2 objects if the bool is false and then when true the two object are allowed to collide. so for example:
I have a bullet that only can deal damage if bool is true which is set to true by reflecting of my object (shield). I want to know if the bullet can ignore collision with everything but the object (shield) that reflects and be able to pass though my other objects (enemies) ignoring collision when bool is false. But if the bool is set to true go back to colliding with my other objects (enemies)

You can change your collider’s “isTrigger” variable to true, to change it into a trigger volume instead of a solid collider. This has the effect of disabling it.

collider.isTrigger = true;