collider2d trigger not effecting circle collider

hey, I bet you guys hear that alot but I’m new to unity so go easy on me :slight_smile:

I’m trying to build a 2d platformer, and I have a character with two 2d colliders (box and circle)
that I want to trigger on and off from the script.

but when I use:

collider2D.isTrigger = true;

it only effects the box collider 2d.
so how do I trigger the circle collider 2d on or off?

“GetComponent” will work for you.

For better optimization consider storing the colliders in a variable. You can either store them by dragging and dropping from the editor into public vars or by using GetComponent.

Javascript:

GetComponent(CircleCollider2D).isTrigger = true;

C#:

GetComponent<CircleCollider2D>().isTrigger = true;

Hope this helps.