IgnoreCollision after a collision takes place.

So with no luck I been trying to cause a projectile that hits enemies only once before ignoring it. Of course since this projectile sticks around for a moment, it can’t just ignore the collisions of all enemy characters, or disable it’s own collision due to this.

I just want collisions to disable specifically for that single enemy, which must happen after the projectile collides with it.

I really thought this would work, however while everything in the code works, it never does the IgnoreCollisions for the next time the enemy collides with this projectile.

function OnCollisionEnter(enemy : Collision) {
	Physics.IgnoreCollision(enemy.collider, collider);
	//Do stuff to the enemy here.
}

Any help would be appreciated, I can’t figure out why this wouldn’t work if in Start and Update functions IgnoreCollision generally works fine.

Is it a boomerang? If not, the next time it gets hit with a projectile it’s probably a new projectile that doesn’t have the ignore collision set. You could ignore collisions from a certain TYPE of object by name or tag or all collisions.

Bool isIgnoring = false;

function OnCollisionEnter(enemy : Collision) {
    if(!isIgnoring){
        isIgnoring = true;
        //Do stuff to the enemy here.
        //When you're done, set isIgnoring =false;
    }
}