Running an Add ParticleSystem action after a Destroyed or End Play event causes the system not to appear where you’d except (if anywhere). Using SpawnEmitter works as expected however.
What’s the difference, in practice, between these two actions?
Original question:
I’m trying to spawn a particle system every time my blueprint actor is destroyed, but neither the End Play nor Destroyed events seem to show the system or place it in the right position.
Here’s what I have, but doesn’t work:
The event does trigger, because putting for example a print string action confirms it, but the particle system doesn’t show up. If I hook it up to some other piece of logic, like after Destroy Actor in an Event Hit chain of events, it spawns correctly.
For example, this works (the end of an Event Hit chain, modified from the fps sample):
Oh, that works. I didn’t know about it, actually. It seemed reasonable to search for ‘particle system’ in the action list. What’s the difference in practice?
I think you are adding the particle system as a component of the Actor that is being destroyed. If you only want to spawn a particle, you should use ‘Spawn Emitter At Location’ node. When an Actor is destroyed, any of its sub-components are also destroyed. So without the parent Actor, none of its components exist.
Now why it worked in the second case is probably because the ‘Add Particle System’ is called right after a call to ‘Destroy’. Perhaps the actual destruction does not happen instantly, so the call might still succeed. On the other hand the event ‘Destroyed’ is called after the Actor is destroyed, which might explain why it is not working.
You can check this by simply doing an IsValid test to see if the Actor reference is still valid.
In any case, ‘Spawn’ is the right method to be used for the effect you are looking for.
You are right with the spawnEmitterAtLocation. to keep it alive when the actor gets destroyed but i want to keep the particlesystem moving with the actor. Is there a way to detach the particleComponent from the Actor, so that it does not get destroyed when the actor gets destroyed. I experimented with ParticleCompoennt->DetachFromParent() but without luck…