0
\$\begingroup\$

I have a prefab with a particle system attached. In the code I play the particle by using this code

            ps.enableEmission = true;

When i run the game, and that code executes, the particle emitter does not emit anything in the "game" window unless i press simulate button in the "scene" window.

Anybody knows why?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You should edit your question with more information about your code and implementation. It is hard to help you debug your code with so little information. Besides, it is not very clear what exactly you meant in your second paragraph there. \$\endgroup\$
    – MAnd
    Feb 24, 2016 at 3:01
  • \$\begingroup\$ What simulate button is in the scene window? I think the Unreal Engine has a simulate button... \$\endgroup\$
    – Ageonix
    Feb 24, 2016 at 3:13

3 Answers 3

1
\$\begingroup\$

Yea, it is difficult to handle it like this.

Just mark it as Play On Awake, set any duration (no unlimited life), make prefab and instantiate it instead of Play or Enable

\$\endgroup\$
1
  • \$\begingroup\$ This is what worked for me. \$\endgroup\$ Apr 5, 2022 at 23:32
1
\$\begingroup\$

For the emission property to work the particle system has to actually be playing. To do this you can either enable Play On Awake in the ParticleSystem component or you use the Play method on an instance of the component.

As a side note, if you are using 5.3+ the enableEmission property is now obsolete and you may want to consider using the emission property. One thing to keep in mind when using this property is you have to assign it to a variable before attempting to modify it:

public ParticleSystem _ps;
...    
private void Update()
{
    ParticleSystem.EmissionModule module = _ps.emission;
    module.enabled = true;
}
\$\endgroup\$
0
\$\begingroup\$

set the particle system as Play on Awake, and disable the particle system. set it active when you want to start and de-active when you want to stop.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .