I’m using a niagara ribbon attached to a projectile. Everything is looking great but I’d like to stop the system spawning new particles when the projectile collides with something.
I’m spawning the niagara system in c++ and have a pointer to a UNiagaraComponent. I’ve tried Deactivate() & Pause() and also tried setting the parameter “SpawnRate.SpawnRate” to control the spawning of particles.
None of what I’m doing is producing the desired result.
Any suggestions on how to achieve this and any best practices for using niagara for a bullet smoke trail? Currently because my niagara system is attached to the projectile I have to leave the projectile actor active (and not immediately destroy it) to give the particle time to complete when it collides.
I have the exact same problem. My smoke and fire particles get attached to the player vehicle when a certain amount of damage is reached. I want to stop the Niagara system when the player character crashes and loses a life, but I cannot destroy the actor altogether.
Deactivate does exactly what the OP was asking for
If the system is attached to an actor that gets destroyed, of course the component will get destroyed as well, killing all particles
If you absolutely want to destroy the actor, you can always detach the component, SetAutoDestroy to ensure that it dies when it’s complete, and deactivate it
But in most similar cases that I’ve encountered, the actor is usually “disabled” so no logic runs, and waits a bit for the effects to end
You can also use AActor::SetAutoDestroyWhenFinished, which will automatically destroy the actor when all latent actions and components on it are finished (by default all components except for Timelines, and effect components are finished allways)
I want to share my solution because setting the emission to 0 sounds just silly to me. I’m sorry…
I’m using blueprints too, but unfortunately, I don’t know the equivalent in c++.
As mentioned before, you have to call “Deactivate” from the BP to stop the particle from spawning. HOWEVER, if you have the “Inactive Response” inside the Niagara System set to “Kill”, the system will immediately destroy all the particles. Instead, you have to set it to “Complete” so your projectile trail will not disappear instantly.