I want to make it so when my player dashes they cant be hit

So I want to make my player invulnerable well dashing. how do I do this without disabling a RB or a box collider?

I presume that you have a function that deals damage to the player. In the places you call said function, put an if statement around it that specifies that isDashing is false. Dunno if this is the most effective answer, but it’s how I would go about it.

Ok so i am using this code

void OnTriggerEnter2D(Collider2D other)
{
switch (other.gameObject.tag)
{
case “projectile”:
break;
case “Player”:
Destroy(this.gameObject);
break;
default:
Destroy(this.gameObject);
break;
}
}

I tried the third idea. it works ish but when dashing the object acts like a wall. I think this is because it has a box collider but it needs this to work so how do I fix this.

@andzq