Hello there,
I often use a script, which sits on things like ParticleSystems of exploding bullets and destroys it after a certain amount of time. The object (like the bullet) doent exist anymore to destroy the particle system.
Is it commen to do so? or is there a better way of handling such things?
I hope you understand me
Tanks for reading and have a nice Day!
(btw: sorry for any misstakes! :D)
Hey there. I would make the particle system a child object of the bullet and once the bullet hits something then play the particle system. Then once itโs played its explosion animation then destroy it. That way its not trying to get something that isnโt there.
But as for a better way would be object pooling. That way there is no destroying and filling up the garbage collector. This way you reuse gameObjects.