Any way to dynamically change particles emission rate

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Rpahut

For the CpuParticles2D , Amount (together with Lifetime) controls the rate at wich particles are emitted. Changing Amount however resets the particle system and all existing particles disappear, so it cannot be used to adjust the emission rate while the effect is in use.

What are possible ways around this? I basically need the particles to spawn at more or less regular interval as the emitter moves around.

The fact it resets existing particles sounds like a bug… or at least a usability issue.
Maybe an alternative is to use explosiveness, which means the amount of particles will be emitted in a shorter period within a cycle, so it will end up emitting at an interval instead of continuously?

Zylann | 2023-07-07 13:44

Why not adjust the speed scale?

spaceyjase | 2023-07-07 15:33

From what I see in the docs, speed_scale might indeed increase emission per second, but it accelerates everything else too, so particles will move faster as well?

Zylann | 2023-07-07 16:06

No other way but to fake it I guess. I raised the Amount to give myself some headroom and I turn alpha down for newly spawned particles via ColorInitialRamp to tune the apparent emission density. Not a great solution but will do for now.

Rpahut | 2023-07-07 18:35

Another fake it until you make it solution could be a duplicate emittier with the desired rate. The two combined might have the desired effect.

spaceyjase | 2023-07-08 08:27