Temporarily disabling an SPS

Hello fellow devs!

I create an SPS at app load and use SPS.mesh.setEnabled(true/false) to toggle it on and off (visually) at a user selection. Does this also disable the SPS.updateParticle type methods from running or just the visual mesh? Is the mesh separate from the other SPS functions that run?

I didn’t see enable/disable functionality on the SPS itself in the documentation although I am going blind in my old age.

I just don’t want to be wasting CPU on SPS calculations when it is not displayed.

Thanks for any insight.


setEnabled does more than make the mesh invisible, it takes it out of the render loop. However this is only for the mesh and not for the SPS itself so I would think SPS.updateParticle would still run.

Actually SPS.updateParticle() is called for every particle only when SPS.setParticles() is called. So if you don’t call setParticles(), whatever it’s in the render loop or not, then the particles aren’t simply updated.

1 Like

Of course

I should have realized that. Since I’m only calling setParticles after the user selects this SPS and I enable the mesh then its not running when the mesh is hidden.

Thanks for the bantering. Helped me think about it from a different angle.

1 Like