How Can I switch between 2 colliders in my 2D Game?

Hey Guys!

I’m almost finish with my first 2D-Platformer.
The last thing I want to do is to bend down my character that I don’t collide with birds. I implemented the Graphics and can call it by pressing the down button on my keyboard. The problem is: The bird applies damage on me even if I’m bend down because I have a mesh collider on my player which touches the box collider of the bird.

I thought I could fix this if I make an if-request: if my player is bend down->Turn off my mesh collider and activate a new box collider, which is smaller, that other animals on the ground can also apply damage to me.

The problem is I have really no idea how to do this.

The control for my character is in the script “PlayerController” and the apply damage function is in may “WaypointWalker” script.
It looks like this:

protected virtual void ApplyDamage (int damage)
			isHit = true;
			currentHealth -= damage;

			if(currentHealth <= 0)
				currentHealth = 0;
				StartCoroutine (DamageEffect ());

Does anyone of you know how I can solve this problem? You would make me very happy!!!

Sarah :slight_smile:

Create two empty game objects that are parented to your character, one with the mesh collider attached and one with the box collider. Name them appropriately. You can search for these objects and disable/enable them when you crouch/stand.

	GameObject standCollider;
	GameObject crouchCollider;

	void Start(){
		standCollider = transform.FindChild("Stand Collider").gameObject;
		crouchCollider = transform.FindChild("Crouch Collider").gameObject;

	void Update () {