ParticleSystem bug after change position

Hi!

  1. Disable particle node
  2. Change position
  3. Enable particle node

You can see that some little time after enabling node it still emitting particles in previous position. How can I avoid that?

I’m not sure if this matters as you are not in runtime, does it ?

same thing in runtime

The emitted particle will not be moved if you use simulation space in world, try to use local to see the result (which I’m not exactly sure will be what you expect)
But I also agree, normally your particle system won’t teleport in runtime

Hi!
The thing is I want to pool my nodes with particleSystem components to reuse them later
When I try to activate (active = true) of my pooled node I can see previously emitted particles showed up in old position

Then you need to explicitly stop the particle system component

I can’t see any difference :frowning:

Maybe you can check it?

3.7.1
NewProject_6.zip (4.5 MB)

The solution is the same as what panda said.

When turning off the active property of the target node, you need to turn off the running of the particle system at the same time (particleSystem.stop).

1

NewProject_6.zip (68.0 KB)

1 Like

Hi!
Thank you
Now it’s clear and works like a charm
Could you please explain why my solution doesn’t work? The only difference between your solution and mine is disabling particleSystem in separate component. I placed particleSystem.stop in onDisable and my component was setted in node with particleSystem

Can you show your code?

It doesn’t work If I move this code to component which setted on node with particles

        this.getComponent(ParticleSystem).stop()
        const particles = this.getComponentsInChildren(ParticleSystem);
        particles.forEach((p) => {
            p.stop();
        })

NewProject_6.zip (4.8 MB)

Hi, the reason for this problem is:

If you set the active of the parent node (target.active) to false, and then execute the stop of the particle system (particleSystem.stop) at this time, this time will not clear the particles.

parentNode.active = false; ===> node.enabledInHierarchy = false; ===> particleSystem.stop; ===> particleSystem.clear (determine if node. enabledInHierarchy is false); ===> do not clear

So, you need to stop the particle system before executing parentNode.active = false.

And, after the node’s active is set to false, it will synchronize the child node, which will cause the child component to call onDisable, so it is consistent with the appeal case.