Playing prefabbed particle systemEffects

Is this a bad idea?

Destroy(Instantiate(deathVFX, transform.position, Quaternion.identity), delayForDestoryingVFX);

---- Where deathVFX is a prefab and delayForDestory is tunable for length of effects

Please give me the goods… LOL the pros and cons

Thanks

Hi Steve,

The Instantiate method gets executed first, and it returns an object, which gets passed on to the Destroy method. I’m not exactly sure to which part of your code you are referring or what exactly you would like to know. If you seek feedback, all I can say is that since the method calls are basically nested here, the code becomes difficult to read. A lot is going on in that one-liner. The computer does not care as it does not read code like we humans do but if you have to debug your code one day and have lots of these one-liners, you would probably want to invent a time machine to tell your past self to improve the readability of the code to make your life easier. :slight_smile:

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

Privacy & Terms