Shouldn't we destroy the particle systems after we're done with them?

Wouldn’t leaving the particle systems persistent potentially cause a drain on Unity? Wouldn’t it be better to have a Destroy(smokePuff, time); in there somewhere?

Better than destroying them is to recycle them. Have them re-start when required.

As in all development questions; it depends. For a game object that is going to be destroyed yes. For example, when I destroy something like a tank or the missle that hit the tank, I instantiate a game object with the particle system attached followed immediately by Destroy(gameObject) which leaves only the game object holding the particle system. Along with the particle system there is a script attached to the game object which destroys the parent object and all of the children after a predetermined amount of time. The particle system being a child of the game object is also destroyed. This is the method I prefer but some developers create a pool manager which holds several game objects and activities and deactivates them when and where they are needed. I prefer the first method but the second is more reusable and extendable.

Privacy & Terms