How to scale a GameObject without scaling the collider

How can i scale a GameObject without scaling the Collider. I am using a PolygonCollider2D and in my case I can not use multiple GameObjects to split the Rendering and the Physics.

Hi fraanns,

One possible solution would be to disable the collider prior to the scaling, then re-enabling it after the scaling.

I don’t have Unity open to test this out, but I think that may be an easy route to test.

Alternatively, you may be able to store the collider details pre-scaling (bounding box, etc.), then redefine the collider post-scaling.

Regards,
Ezro

I think for a PolygonCollider2D, you will have to rewrite the paths. As an alternate, you could have two copies of the game object, one with the path but the renderer turned off, and a child without a collider that you then scale.