MountainSide Studios MountainSide Studios - 3 months ago 8
C# Question

How To Disable A Select Collider

I have a character with 2 2D Colliders in Unity, one for the head, and one for the feet, How do I Disable only the Head Collider in C#.

Answer

Something like this:

public Collider2D headCollider;  // drag and drop head collider to this in inspector.

void DisableHeadCollider()
{
    headCollider.enabled = false;
}