E
E
Erik21212017-06-20 13:46:02
C++ / C#
Erik2121, 2017-06-20 13:46:02

How to enable Particle System -- Emission?

Good afternoon!
Look, I have a fire extinguisher, it has a Particle System as a "foam", well, such white particles are like foam, but not the essence, see initially it should be disabled, that is, I just turned off Emission in the properties, then I want to create a script click to turn on the foam.

public class fire_ex : MonoBehaviour {

    public ParticleSystem.EmissionModule emission;
    public GameObject isObject, pl;
    public string objName;
    public GameObject Sm;
    public ParticleSystem Smoke;

    // Use this for initialization
    void Start () {
        Smoke = GetComponent<ParticleSystem>();
  }
  
  // Update is called once per frame
  void Update () {
       
  }

    void OnMouseDrag() {
        isObject = GameObject.Find("fire");
        var emission = Smoke.emission;
        emission.enabled = true;
    }
}

It gives me an error
Do not create you own module..
Tell me how to do this, thanks.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2017-06-20
@Erik2121

You need to turn off not the module, but the particle system itself. The module must be disabled if you are going to manually spawn particles using ParticleSystem.Emit . In your case, it's better to pull Play , Pause and Stop at the right time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question