Any benefit to destroying the particles with a script of built in way?

Hey just noticed in " Instantiate At Runtime" video that we are destroying instantiated particle systems with a script. Unity seems to have a built in way of doing this for particle systems. If you change Stop Action to Destroy it automatically destroys the particle system when its finished

Is there any benefit to doing it the way described in that video?

2 Likes

Hi Patrick,

Welcome to our community! :slight_smile:

That’s a good question. I, personally, don’t see any reason why we should not destroy the particle system with he built-in option. Maybe Rick didn’t know that there was such an option, or he wanted to make it clear what we are doing in our game. Unity is fairly complex, and it is easy not to know a feature or to miss or forget something.

Please feel free to test your idea. In many cases, there are multiple ways to make something work in Unity, and Rick cannot show all of them. If your way works, it’s a solution by definition.


See also:

I can imagine particle systems are one type of objects where it makes a lot of sense to have the ability to self destruct already contained since there would be many occasions where they will be used in a one-shot fire-and-forget manner, so it’s nice to have a quick way to get rid of them.

There will be other occasions where one would have some object temporarily and need more control over its destruction, and other uses of similar coding techniques, so it makes a lot of sense to explain this approach in the course as well…

I tweaked my CollsionHandler script to have the ship explode and disappear into the VFX’s cloud, and since I currently have no better way to do this, I added another method to cascade several Invoke() calls in order to time the sequence of “start explosion”, “make ship disappear”, “restart with LoadScene()” with some delay inbetween… I’m quite sure there are much better ways to do this, but for the time being it works sufficiently well for me…

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms