Can I test collision inside an edge collider area in Unity?

I have a triangle with its perimeter represented by an EdgeCollider2D, and I want to trigger an event when the player reaches this area.

So I set the collider as a trigger and, I used the OnTriggerStay2D function in my code.

But the event works only when the player is intersecting the line of the collider, not when the player is inside the triangle but not touching the edge.

How can I continue to get OnTriggerStay messages when I'm inside the triangle, not touching the edges?

1 Answer

No, you cannot test collisions inside a region bounded by edge colliders.

An edge collider is just that: an edge. It has no internal area to test with, it's just the edge and nothing but the edge.

To represent a shape with an interior area, you can use a PolygonCollider2D.