How to prevent Particles2D node from pausing emit state when it's not visible?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By wingedadventurer
:warning: Old Version Published before Godot 3 was released.

Here’s the thing. I have an object that constantly emits particles. At some point in my game I want to hide the object (with particles as well) which I do by setting its modulate.a (alpha) to 0. (I’m using Godot 3.0). After some time I want to make the object visible again and I do it by setting modulate.a to 1.

The problem is that the particles stayed in the same state they were when I hid the object.

I tried setting the alpha to 0.01 which works fine, but the object is still barely visible in some scenarios.

My guess is that particles system (and probably everything else) freezez when not visible. How do I disable this freezing/pausing?

Modulate.a pauses the emitter too? that is interesting (maybe a feature?)

Try changing the particles material color instead of the emitter.

eons | 2017-12-31 14:54

How do I do that? I’ve tried to access the material, but Godot doesn’t seem to find it (it prints that process_material property is null even though it’s set to ParticlesMaterial).

wingedadventurer | 2017-12-31 15:26

I have tried and can do $Particles2D_node.process_material.color.a = 0

eons | 2018-01-01 16:23

I have just tried that, but it does nothing. When I manually navigate, I notice that Particles2D node has a “process_material.color” property, but it’s not actually a color. It’s a Color Ramp and I don’t believe that can be manipulated in the way I want.

wingedadventurer | 2018-01-01 19:21

I do not know what may be happening there then because I can use color normally.

Maybe you can post more details about your particles setup.

eons | 2018-01-01 19:41

I actually tested your proposition in new project and it worked! Now I’ve checked my code better and realized I made a stupid mistake – because I’ve messed with Color Ramp thing, I’ve accidentally created one that was overriding any color settings!

Now that it’s fixed, what you said actually works, the emitting doesn’t freeze. Thank you!

wingedadventurer | 2018-01-01 20:59

:bust_in_silhouette: Reply From: wingedadventurer

As user eons proposed, the answer was to access Particles2D’s Process Material and set the alpha color of that material to 0, like this:

MyParticle.process_material.color.a = 0

This will not freeze the emitter. Thanks, eons!

:bust_in_silhouette: Reply From: raeynn

I couldn’t disable pausing on the particles, but solved this by using restart() when re-enabling visibility on the parent object:

func reveal():
    show()
    $Particles2D_node.restart()