At start of a level, I generate at random positions lots of prefabs, I want to delete them all at gameover, so I can restart the level, recreating the prefabs…
I know how to destroy them when my player collides with it, but how I traverse all of them ?
if u dont have static calling Application.LoadLevel will automatically do this ,
if not have a boolean and turn it false at the end of the level. And inside the prefab script check if tht boolean is false, if so call delete function. simple as that.