Sprite Mesh at Runtime?

Been super busy here today so I haven’t had a time to play and check, but does anyone know if it’s possible to modify a sprite’s alpha (think landscape damage) and update it’s polygon collider/render mesh on the fly with 4.3? Or can you only swap out for pre-calculated/drawn sprites?

If im not mistaken, I think they said here that cannot update collider on the fly like that (or was it about animated sprite, collider wont animate…)
Unity Hangout 3: 2D

You can update polygon colliders dynamically using PolygonCollider2D.points and .SetPath.

–Eric

But I take it you have to do your own edge detection then, there’s no way to use Unit’y own alpha edge finding path simplification algorithm?

Not so much of a big deal, but it would be nice to have that inbuilt.

I assume not, but the docs for the PolygonCollider2D constructor are, shall we say, a bit sparse, so I don’t know what the options actually are.

–Eric

I’m wondering this too, the release notes say

It sound to me like this mesh is not the PolyconCollider2D, but rather part of the Sprite itself.

The mesh for displaying sprites and the auto-generated PolygonCollider2D are separate things.

As far as updating the collider on the fly, one thing you can do is change the sprite, destroy the PolygonCollider2D, then add a new PolygonCollider2D.

–Eric