Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

New particle system in v5.3, can emission be enabled/disabled in code ?

Discussion in 'Scripting' started by nasos_333, Mar 5, 2016.

  1. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,827
    Hi

    I used "ParticleSystem.enableEmission" to start/stop particle emission in code. The new system uses ParticleSystem.emission.enable to set emission status, but when i try to assign to true/false i get an error stating that is read only.

    Is there a way to code emission start / stop in v5.3+

    Thanks
     
  2. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    Have you tried the 'Stop()' method?
     
    nasos_333 likes this.
  3. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,827
    My code was using the other mode, so would require more testing and i am looking at a similar feature.

    I will check this option out too, thanks
     
  4. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    For everyone else coming here: See http://forum.unity3d.com/threads/enabling-emission.364258/

    TL/DR:

    Code (CSharp):
    1. var emission = ps.emission;
    2. emission.enabled = false;
    No need to assign emission back to the particle system. (In fact, that's prohibited.)

    A more informative Obsolete message for enableEmission would be nice. Also, one without typo ;)
     
    nasos_333 likes this.