Collider2D.IsTouchingLayers doesn't detect Composite Collider 2D

Hi,

I have a tilemap with a Composite Collider 2D and a Tilemap Collider 2D which is used by the Composite Collider. On my player gameobject I have a movement script and when I want to jump it checks if it’s collider is touching the “ground” layer. When the “Used by composite” is unchecked on the Tilemap Collider it works perfectly fine, but when I enable it I cannot jump anymore. The tilemap’s layer is set to “ground”. I have no idea what’s going on. Please help :cry:

Thanks.

Those calls don’t work with specific colliders, they simply look for contacts on those layers so if there’s a contact (I presume your player still contacts so shouldn’t change anything) then it’ll see it. Changing it to composite won’t change it so I have no idea what else you’re doing here. You’re using “Outlines” on the composite which changes it to, well, outlines i.e. edges so you’ll no longer get contacts “inside” tiles because it’s only outlines. This is the same as the EdgeCollider2D.

You can see contacts if you opent the “Info” inspector rollout on any collider2d/rigidbody2d component.

1 Like

I was checking for contact inside the tiles. Changed the composite from “Outlines” to “Polygon” and now it works.

Thanks a lot.