Add PolygonCollider2D from code and ignore sprite mesh

I’m adding PolygonCollider2D at runtime with code on the objects that have SpriteRenderer.

And doing that automatically makes this polygon the same shape as the sprite. That leads to profiler spikes with “MeshGenerator.TraceShape” and “SimplifyShape”.

I don’t need that, because I’m changing the polygon shape manually right after it was added. Also, I don’t want to add a collider to any other object.

So, my question is - can I .AddComponent() which will ignore the attached SpriteRenderer and will create a default (pentagon) polygon shape?

Hello, I was wondering whether you found a solution to your problem, I kind of have the same issue.