When a character collides with an enemy, the character must get the ability to pass through enemies with the Enemy tag for n seconds, but he must still be able to walk, jump, and so on.

There was an idea to attach a second BoxCollider2D at the foot level with a minimum height to the enemy, and activate it in a collision with a character, and BoxCollider2D off the first BoxCollider2D , but it seems to me that this is a way and you can do it more correctly and easily.

    1 answer 1

     public OnCollisionEnter (Collision collision) { if (collision.gameObject.tag == "Enemy") { Physics.IgnoreCollision(collision.collider, collider); } } 

    I think, with a delay myself will understand :)