Creating destructible environments

Hi all, how would I go about writing code for destructible environments . I know the basic way would be like

// sudo code
void OnCollision()

{
if(Force>20)

{
//Instatate prefabs


}

}

is their a cleaner way to do this ?

well your code looks as clean as it gets since there is nothing in it.

This is a sample, I know the real code would be something like instainate prefab a at local position a , ect .
But before I go though actually making something like this i’ve like to know if theirs an easier way to do it

well the way you are mentioning it such as having a model then instantiatin a premade object would pretty much the easy it will get, any more than that you need to have a lot of knowledge of vectors and geometry if you are trying to make something dynamic