Collision with Texture when alpha=1

I’m building a destructible 2D terrain, similar to the game worms for example.
I achieved that by using a texture as reference for collisions, I did it by generating a mesh from the texture and attaching it to a MeshCollider … this works … but its too slow with my current algorithm. It needs to run in real-time.

I’m not sure if building a mesh is the best way to calculate collision from a texture in Unity.

How would you go about doing this, is there an other way or should I just try to optimize the mesh algorithm, I’m not sure.


I usually just use a plane for the texture, then attach a BOX COLLIDER to it. Not sure what you’re aiming for but it would probably save you performance by adding the colliders in the editor. Hope this makes sense / helps.