CPU Particle resets every time 'amount' is changed

Godot Version

4.2.1

Background

I have a CPUParticles2D attached to a creep. I want the number of particles to increase in relation to the damage the creep has accumulated; the less health a creep has, the more particles it emits.

Issue

Every time the amount is changed, all existing particles are deleted and new ones start getting emitted. This results in effectively no particles being emitted while the creep is being attacked as the health changes each frame.

This does not seem to be a code issue. If you set up a basic particle emitter in the UI and click the up or down arrow in the amount property editor, you will see the particle system reset.

While I haven’t tried all the properties, of the few I have adjusted, none of them cause a reset.

Question

Is there a way to get the CPUParticles2D to not reset while changing this property?
Is this intended behaviour?
Or is this just a side-effect of the implementation that is inherent in particles?
Or is it a bug?

I encountered this issue too. I tried to add more leaf particles but it ended up resetting to new particles (deleting the old one) when trying to adjust new amount value
but this one with GPU Particle 2d node
godot 4.1.1

my workaround is to add another GPU Particle 2d at the exact spot and it will emit when i needed to. So, i dont touch/change the base particle amount on the other one.

1 Like

That’s what I’ve done, too. It’s not as nice I was hoping for, but it’ll do for the moment.

The problem is changing the amount has to recreate the pool of particles. This is unavoidable for the performance gain. What you can do is the the amount as if it is the maximum amount, then set emit to off and use the emit function from code to place particles exactly where you want them. It’s more work, but gives you full control of how many and where spawn.

1 Like

My particles are not one-shot, so I’m not sure that your solution applies in that situation. If your solution does apply, then I’m not clear how to apply it :slight_smile: