18 January 2017
1) Editor performance.
C# scripts run waaaaaay slower in the editor. You wouldn't notice it for simple scripts, but for something as complicated as meshing, you will. Try it in a build.
2) You're exploding too many voxels.
What's the sort of radius you're trying to destroy compared to the size of the voxels?
I don't know if you're familiar with Minecraft at all, but I often use that as an analogy to try to explain. TNT in Minecraft has an explosion radius of about 7 blocks.
In Picavoxel, if you set a radius of 2 on the exploder script, and are using a default size of 0.1 units per voxel, that is a radius of 20 voxels, around 3 times the size of a TNT explosion in Minecraft.
To explain it in more detail, using the above values of an explosion radius of 2 and a voxel size of 0.1, the total number of chunks affected can be anywhere up to 16 (40^3 voxels explosion volume divided by 16^3 chunk size). That means that we need to recalculate the meshes of 16 chunks, which is quite expensive.
3) Meshing Mode.
Greedy meshing takes more time to calculate than simple culling. Try switching to culled mode for your explosion target volume. When optimizing your game, you'll need to balance between triangles rendered and the need for volumes to explode.
4) The out-of-the-box exploder script.
The exploder script is good for getting up and running with explosions quickly, but it does have the limitation that it checks for explosions against all volumes in the scene. In your own games, it is never likely that you would need to do this and would instead be checking for explosions on a specific volume or set of volumes, at a specific location. In this case, you can simply call Explode on the Volume class. For example:
wall.GetComponent<volume>().Explode(bullet.position, 0.5f, 0, Exploder.ExplodeValueFilterOperation.GreaterThanOrEqualTo);</volume>