I was looking through the Volume script and was pretty appalled by the use of Vector3.Distance twice for every check in Batch Explode. I made some changes to improve the explosion update speed, and decided to share them here.


I first store the square of the explosion radius before the triple for loop. Inside the for loop I calculate the square magnitude of the check position from the explosion position, and store it as the distance. I then compare the square distance to the square explosion radius instead of using Vector3.Distance. This same comparison is also used later for the last argument in the final if statement.

These changes allowed me to effectively triple my maximum explosion radius with as many concurrent explosions as I could possibly need. So I hope you guys get some good use out of this as well.

Last edited 18 May 2017