Collision2D.GetContacts has no filter overload?

Hello,

Im trying to filter the collisions in my OnCollisionEnter2D callback function, but GetContacts on Collision2D has no overload method with ContactFilter2D (see Unity - Scripting API: Collision2D.GetContacts)

Is this normal? Is there something I don’t understand about this new way of getting contacts?

My intention was to use layermasks with ContactFilter2D to improve performance, instead of having a big if with ORs on the collision2d.gameObject.layer.

Thank you

But you can get the Collider2D from the Collision2D, and that has got a filter version.

Yes indeed, and there is also the Physics2D.GetContacts static method and others. But I was just wondering why there is no contactFilter for collision2d.GetContacts method

Well, it seems rather redundant to have it on Collision2D, since you can just do: collision.collider.GetContacts(). Then again, why have a filterless version, but not the other variants…