The scenario: you have an actor that you need to kill. However, the actor has a particle emitter, and the particles must continue to live until their own death. Imagine a rocket leaving particles and then blowing up. The problem is that destroying the actor also stops the particle emitter and destroys all particles that are already spawned.
Currently it’s possible to achieve this, but it’s complicated. You need to stop/kill all necessary components on your actor without destroying the actor itself (mesh, lights, sound, maybe other particle emitters etc). You also need to take care of anything else that has a relation to your actor and changes behavior after you actor’s death. Of course you also need to set a timer to destroy the actor after some time, so that multiple dead actors don’t accumulate.
It would be nice if at the moment you destroy the actor there was a way to easily specify particle emitters in it that should keep their particles alive.
P.S. You can find a workaround here How to stop a particle system from spawning and remove when active particles are dead? - Programming & Scripting - Unreal Engine Forums
Good idea. There’s a node called “Spawn Emitter Attached”. It works, but detaching it doesn’t work. As soon as you execute a “DestroyActor” node, the particles instantly disappear.
Both “DetachFromActor” and “DetachFromComponent” nodes don’t do anything if the next node is “DestroyActor”.
It’s weird having a smoke trail instantly disappear like that. Is there a way to detach a component and make it its own thing in the world?
Ok, I found an “easier” way:
Create a Blueprint with just the particle system, preferably with a Scene component as the root component (so that you can rotate/offset the particle system any way you want). Now go back to your rocket Blueprint and create a “Spawn Actor from Class” node, spawning the previously mentioned Blueprint, and attach that particle blueprint to your rocket (or space ship, whatever). Then, right before “DestroyActor”, deactivate the particle system from the attached Blueprint.
Here are some screenshots:
This is not a complete solution since you are not ever destroying the particle emitter which would lead to a memory leak if the emitter was to be spawned on every rocket created. We need an easier way.
Actually all you need to do to achieve what you said using his method is “Set Life Span” on the Particle blueprint and deactivate it before DestroyActor.
No memory leaks.
I’m using a ParticleSystem component. It sounds like you are using a separate actor for your particle system. Components don’t have life spans to set.
My comment was based on Andrei’s suggestion. He is suggesting to use a separate BP for the Particle System. You said, his method is not complete because he isnt destroying the emitter. I pointed out that all you need to do is set the life span of this separate BP.
You may be using a component. That is irrelevant to this conversation because we are responsing to Andrei’s suggestion.
Got it. Thanks for clarifying.