The particles are dissappearing!

Godot Version

v.4.1

Question

Hi everyone!

Strange situation: I created a simple explosion based on GpuParticle2D for my enemy death. All was ok, but when I killed 2 enemies, the first explosion was be deleted. I mean: each subsequent explosion removes the previous one before it finishes its work. I tried to change queue_free() func to set_mode, but the problem remains.

Has anyone ever met with this kind of stuff?

Resources are shared by default. Modifying one instance will modify all other instances. Try to Resource.duplicate() both the process_material and the scale_curve before modifying them.

I tried to add this in the beginning of initialize func:

process_material = process_material.duplicate()
scale_curve = scale_curve.duplicate()

May be I don’t understand something, but the problem remains

By the way I tried this:

var process_material1 = process_material.duplicate()
var scale_curve1 = scale_curve.duplicate()

process_material1.set(“emission_box_extents”,
Vector3(sprite.get_width() * s.x / 2.0, sprite.get_height() * s.x / 2.0, 1.0))
scale_curve1.add_point(Vector2(0.0, 4.0 + (s.x - 1.0)**2))
scale_curve1.add_point(Vector2(1.0, 0.0))
process_material1.scale_curve.set_curve(scale_curve1)
process_material1.initial_velocity_max = 400

lifetime = 3.0 + 0.1 * (s.x - 1)

amount = sprite.get_width() * s.x

set_process_material(process_material1)

one_shot = true
emitting = true

It doesn’t work to :frowning:

Then it may be that the GPUParticles2D.visiblity_rect is out of the viewport. Make sure that the GPUParticles2D.visiblity_rect is inside the viewport.

Unless you post a video or gif showing the issue it’s hard to tell what’s the problem you are facing.

I think you were right about the problem. When I add a print func i saw this:
image

Explosions are different but the Process_Material is the same for everyone

That is how the problem looks like