Tilemap composite collider confusion - trigger events called twice

I’m a little confused by the composite collider workflow and OnTrigger2D events being called twice. I have a tilemap with a rule-tile drawing runtime generated walls perfectly. The TileMapCollider2D shows all the pieces, and the CompositeCollider2D shows a beautifully simplified collider shape…

7524254--928466--upload_2021-9-26_15-46-53.png

If I use the TileMap Collider without the composite, my CircleCollider2D trigger ‘agent’ activates OnTriggerEnter2D the moment it crosses the tilemap collider threshold. Agent can move inside the wall without activating any triggers, and only calls OnTriggerExit2D the moment it is 100% outside the collider. This is normal Physics2D behaviour.

However, using the Composite Collider, OnTriggerEnter2D activates when the agent first crosses the threshold into the tilemap wall, and when it first crosses the threshold when leaving. Similarly, OnTriggerExit2D actives the moment Agent pokes its nose out of the wall and again when it final exists the wall completely. This leads to nonsense situations like an agent entering a tilemap trigger and then registering exit while inside it.

This is on 2020 LTS. Is this a bug?

Exact same problem here. Did you find a way of fixing it? I’m using 2021.3.0f1

No IIRC. This was a prototype testing things out before starting that project later this year. I shouldn’t be using “OnTrigger” callbacks, only overlap tests, so it should not affect me now. Failing that, I was thinking of breaking the composite with a single separate tile (eg. door, single wall tile).