Passing a parameter to Niagara System from blueprint

Hello!

I’m trying to set a float parameter into Niagara-system from blueprint, but no matter what I try, the parameter’s value doesn’t change in the system.

I’m using the Set Niagara variable in blueprint function which has the particle component attached:

The Distance is set to user parameter in the Niagara

I have tried to use the value to kill the particles when it’s greater than 1, which it should be if the value would get passed.

Here’s the system overview:

I have seriously no idea as to why it’s not passing, and would really appreciate help.

Thank you

It seems like I can only set the Niagara variable in Event Beginplay, so that it updates the parameter in Niagara. Is that actually the only event in which the variable can be changed? In functions or in Event Tick, it just doesn’t set the variable. Shouldn’t the parameters still be settable after the set up of the Niagara system?

You must write the name of the parameter as it is, without the namespace (User)
So you have to write Distance instead of User.Distance

You can also of course set parameter values on Tick, however depending on when the system reads the variables, you might not see a result. For example if the system only reads the variable on EmitterSpawn, or maybe even ParticleSpawn, any existing loops or particles will not react to an updated value, unless they handle it in their Updates
In your case you seem to be reading it on Update so it should work

Also if you want to kill all particles of a system or emitter, you can Deactivate the system, or use SetEmitterEnable to deactivate a specific emitter in the system
Then in your System/Emitter State modules you can specify the inactive response, and one of the options is to kill the particle instantly.

You can always do Activate/SetEmitterEnable(true) later to restart the system/emitter, and let new particles spawn again

Thanks for the answer!

I’ve tried it with just the Distance, but it doesn’t work either. My goal is to remove the particles dynamically based on the value passed with the Distance variable, so just deactivating the system doesn’t work for me. I’m just using the passed value to kill all of the particles to see if the value is being passed at all, which it isn’t.

I’m using ribbon particles that are spawned once to visualize a spline path that the user is drawing using blueprints, so restarting the system doesn’t work, because that will make the path be drawn again and again from the start, which isn’t visually compatible with the system I’m making.

Are there perhaps some settings that could prevent the Distance value from being passed to the Niagara system?

I was able to fix the problem by switching the removal logic to RibbonParticle emitter, which was able to get the passed variable.