Chancing PolygonCollider2D shape in runtime.

Hi,

We have a nice feature in Unity that let you drag and drop sprite to a PolygonCollider2D component and it generates the collider for you. Is there a way to use this feature in runtime? I checked documentation and other forums releated to this topic and I was unable to come out with any solutions.

If this feature is not available in runtime is there a way to do it manually by first reading the mesh from spriterenderer and then puting it into PolygonCollider2D?

tkok

It can’t be done at runtime and there’s no way to read a sprite mesh. So you’d have to implement it from scratch.

–Eric