Particle System Component question

(Alien) #1

I’m trying to enable/disable the emission of a particle system on a basic game object

1 - I am able disable the object.
1 - I am able to disable the object referencing by the component
2 - I am able to disable the renderer
3 - I am able to pause the component (which mostly seems to do what i want, but not really)
4 - i also tried to create a variable of type ParticleSystem.emissionModule but there isn’t that type.

5- lastly i tried to place the Variable (FlamerFx) of type ParticleSystem in a particleSystem.EmissionModule
(numbers referenced in the picture)

Basically i’m trying to enable|disable this check mark on the particle.

here is one error. most likely related to wrong var type conversion.

Can you help me? I’m sure I’m missing something basic.
(using the new particle system, not the legacy particle emitters)

(Leslie Young) #2

I’ve not used the new particle system via scripting yet so I am not sure what the correct way is to stop it.

Looking at the docs I see a Stop function. Maybe that is what you are looking for, or perhaps even Pause?

Just enable the ParticleSystem group in Blox settings and you will see blocks for those two functions.

(Alien) #3

yes, i can pause it. but i can’t figure out how to turn on and off the emitter itself.

looks like the particle system was split into a number of classes, like ParticleSystem.EmissionModule, etc. so it wasn’t clear on how i would put the blox together to disable the emissions.

basically trying to do this, trying to use the enable/disable,:

(Leslie Young) #4

oh… so you want to do something to a module of the particle system.
You need to get a reference to that module and then do whatever you want with it.

(Alien) #5

bingo, thanks again.

(Leslie Young) #6

Don’t know if they mention it in the Unity docs but the way these modules work you need to get a reference to one and do your work on that.

You can’t simply do (in code and thus Blox too)
flamerFx.emission.enabled = false;

but have to

PartcleSystem.EmissionModule em = flamerFx.emission;
em.enabled = false;