Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

ParticleSystem doesn't play

Discussion in 'Scripting' started by litebox, Dec 26, 2015.

  1. litebox

    litebox

    Joined:
    Aug 29, 2011
    Posts:
    115
    Hi,
    After I update to Unity 5.3.1f1 from 5.2.3f1 my particle systems don't play:
    they play in Editor Simulation Mode, and they play in game if I use Play On Awake.

    In my script I use next code, initialization:
    Code (CSharp):
    1. _collisionParticles = transform.parent.FindChild("PlayerCollisionParticles").GetComponent<ParticleSystem>();
    To play I use this code:
    Code (CSharp):
    1. _collisionParticles.Play();
    And to stop:
    Code (CSharp):
    1. _collisionParticles.Stop();
    Also, while I log _collisionParticles.isPlaying before and after I notice, after Play() it logs true, but after Stop() it remains true - and in both states I don't see any emission.
     
  2. litebox

    litebox

    Joined:
    Aug 29, 2011
    Posts:
    115
    I made a test (zip in attach): I create new project in Unity 5.3, create default particle system and try to Play it via script - nothing happened.

    Could someone download project and try to reproduce problem? I thought, the problem in project upgrade from old format to new, but it looks like this is a permanent bug... I cannot google any similar problems with particles in 5.3, so it looks like only I have this problem.
     

    Attached Files:

  3. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    2,677
    I was able to reproduce the problem (Unity 5.3.1p1). The odd thing is, if you call particlePlayInvoke() from Start() directly (not using Invoke) particles start playing. I thought maybe it's related to Invoke() and replaced it with a coroutine, but it has the same issue. So, my second thought would be it's not related to Invoke, but more an issue with ParticleSystem itself.

    As far as I know, they changed a lot of the particle system code in 5.3 and changes often come with new issues.

    I'd submit the test project you have as bug-report, along with a nice how to reproduce list/description.
     
  4. litebox

    litebox

    Joined:
    Aug 29, 2011
    Posts:
    115
    Thank you, I made a bug report: (Case 757461) ParticleSystem doesn't play
     
    yc960, Gburdeti and Peter77 like this.
  5. DenisM

    DenisM

    Joined:
    Dec 6, 2013
    Posts:
    62
    Same issue here. A dirty workaround to change "sumulation space" to "world". This will allow to play particle system from script and from editor.
     
    ephemeral-life and litebox like this.
  6. Denchyaknow

    Denchyaknow

    Joined:
    Aug 4, 2015
    Posts:
    21
    Same here been having alot of issues with trying to manage my texture sheet particles. For me they seems to be stuck playing reported by debug.log, and I have to launch Stop() multiple times to make it stop. A work around was to add into method that plays the system a little simulation code.

    public void PlayParticles(int i)
    {
    pSys.Simulate(1);
    pSys.Play();
    }

    guh seems really dirty I know but it works :(

    using 5.3.1p1
     
  7. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    311
    Last edited: Dec 31, 2015
  8. Gburdeti

    Gburdeti

    Joined:
    Dec 23, 2015
    Posts:
    4
    Hi,

    I have the exact same issue.

    I call play() and stop() and nothing happens, but if I set the particle system to play on awake it runs fine. This is very frustrating. I hope this issue is fixed soon.

    Edit: Sometimes the particle system plays, but only sometimes.

    Edit 2: IsAlive seems to not work either.
     
    Last edited: Jan 3, 2016
  9. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    311
    Make sure to report an official bug by making a demo in a fresh project and with the project opened, using the Help > Report a Bug... menu action.
     
  10. litebox

    litebox

    Joined:
    Aug 29, 2011
    Posts:
    115
    I already made bug report (Case 757461 ParticleSystem doesn't play), QA team say when they decide in which version they fix it they write to me back.
     
  11. skok

    skok

    Joined:
    Jul 13, 2015
    Posts:
    6
    I found out something very interesting: the particle system plays correctly if you add an empty subemitter.


    Which brings me to the following topic, because I tried to add a subemitter through code: you can not change the parameters of the partcle system at runtime.

    For example, the EmissionModule struct is exposed as property. Because a struct getter returns a value and not a reference, C# does not allow you to change the parameters directly, only through getting, changing and setting again. However, there is no public setter...

    UPDATE: it works even if you just enable the subemitter module, no need to add an empty subemitter.
     
    Last edited: Jan 4, 2016
  12. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    311
    I got an e-mail yesterday that stated:
    Guess we can hope for an official fix soonish.
     
  13. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    224
    Yes it will make things run again, but with subemitter enabled, automatic culling is off. Which defeats the purpose of pooling the particle system since I use pooling to improve runtime performance. If I am going to do that might as well just instantiate on use and destroy afterwards. I cannot believe such a critical function broken and they did not instant hot fix this thing.
     
  14. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    224
    Not fixed in 5.3.1p2, disappoint.
     
    litebox likes this.
  15. Gburdeti

    Gburdeti

    Joined:
    Dec 23, 2015
    Posts:
    4
    Just to let you know that I posted a bug report about isPlaying() and isAlive() not working as it should. Got a reply that it was fixed in 5.4.
     
  16. litebox

    litebox

    Joined:
    Aug 29, 2011
    Posts:
    115
    I got e-mail from Unity's QA: "We have fixed this and problem should not appear in the upcoming patch release (5.3.2p1)"
     
  17. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    372
    I'm on 5.3.2p2 and i'm still having a ton of issues just getting particle systems to play. Why is this so difficult, they've been broken forever.
     
  18. ephemeral-life

    ephemeral-life

    Joined:
    Sep 12, 2015
    Posts:
    488
    I wish I would have read this an hour ago - would have saved me a lot of sanity. Thanks a lot for the dirty fix. :)
     
  19. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,414

    Yes, the dirty fix works. but I get a ton of errors now (that do not interupt play in editor tho).....


    At Play()...
     
  20. ephemeral-life

    ephemeral-life

    Joined:
    Sep 12, 2015
    Posts:
    488
    They'll fix it eventually I hope. Didn't run into those errors while testing myself. Are you confident it's due to the particles?
     
  21. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,414

    100%


    Have not tested outside of unity. Hopefully it does not crash iOS,
     
  22. IAMBATMAN

    IAMBATMAN

    Joined:
    Aug 14, 2015
    Posts:
    272
    Did they fix this? Should I update unity (I want to work on my project and don't want to have to redownload unity unless this is working)
     
  23. Collywobbles

    Collywobbles

    Joined:
    Nov 10, 2014
    Posts:
    6
    This is still in issue in 5.5.2. I am having to use Simulate(1) before the Play() as mentioned above otherwise no particle effect appears.
     
  24. artaka

    artaka

    Joined:
    Feb 19, 2013
    Posts:
    118
    Emit() does not work properly either in 5.6.0.f3. When Simulation Space is set to Local, it works the first time Emit() is called. However, it stops working for the consecutive calls. Once Simulation Space is set to World, it works every time.
     
  25. reigota

    reigota

    Joined:
    Mar 23, 2010
    Posts:
    55
    5.6.0f3

    .Play() does not work IF prewarm is not true.

    Any workaround??
     
  26. Ironmax

    Ironmax

    Joined:
    May 12, 2015
    Posts:
    892
    fix this before implementing any thing new and fanzy.
     
  27. Eoghan

    Eoghan

    Joined:
    Jun 6, 2013
    Posts:
    63
    Sending a hello message from Unity 2017 - this bug still exists two years on.
     
  28. djsegler

    djsegler

    Joined:
    Apr 20, 2016
    Posts:
    19
    I see this bug in 2017.2.f3.
     
  29. BitMonk

    BitMonk

    Joined:
    Oct 13, 2017
    Posts:
    7
    Same here, dissapointing as they said, the new Particle System is buggy.
     
  30. DoublePixelStudios

    DoublePixelStudios

    Joined:
    Feb 27, 2014
    Posts:
    97
    .Play() does work if prewarm is not true.. I have a particle system in my game and prewarm is off and my code works fine..

    Code (CSharp):
    1. ParticleSystem dust;
    2. public GameObject _particleHolder;
    3.  
    4. void Start ()
    5.     {
    6.         dust = _particleHolder.GetComponent<ParticleSystem>();
    7. }
    8.  
    9.  
    10. /// In one of my methods i call
    11.  
    12. _particleHolder.GetComponent<ParticleSystem>().Play();
    then Stop in another ..

    Code (CSharp):
    1. _particleHolder.GetComponent<ParticleSystem>().Stop();
     
  31. DoublePixelStudios

    DoublePixelStudios

    Joined:
    Feb 27, 2014
    Posts:
    97
    @litebox here you go.. Not tested but in theory it should work

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ParticlesTest : MonoBehaviour
    5. {
    6.     private ParticleSystem _collisionParticles;
    7.  
    8.     // Use this for initialization
    9.     void Start()
    10.     {
    11.         _collisionParticles = GetComponent<ParticleSystem>();
    12.  
    13.         Debug.Log("Start");
    14.  
    15.         Invoke("particlePlayInvoke", 2.5f);
    16.     }
    17.  
    18.     private void particlePlayInvoke()
    19.     {
    20.         Debug.Log("_collisionParticles.isPlaying before: " + _collisionParticles.isPlaying);
    21.  
    22.         _collisionParticles.GetComponent<ParticleSystem>().Play();
    23.  
    24.         Debug.Log("_collisionParticles.isPlaying after: " + _collisionParticles.isPlaying);
    25.     }
    26.  
    27.     // Update is called once per frame
    28.     void Update()
    29.     {
    30.  
    31.     }
    32. }
    33.  
    or if its atatched to an empty gameobject like mine is..

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ParticlesTest : MonoBehaviour
    5. {
    6.     ParticleSystem _collisionParticles;
    7.     public GameObject _particleHolder;
    8.  
    9.     // Use this for initialization
    10.     void Start()
    11.     {
    12.         _collisionParticles = _particleHolder.GetComponent<ParticleSystem>();
    13.  
    14.         Debug.Log("Start");
    15.  
    16.         Invoke("particlePlayInvoke", 2.5f);
    17.     }
    18.  
    19.     private void particlePlayInvoke()
    20.     {
    21.         Debug.Log("_particleHolder.isPlaying before: " + _particleHolder.isPlaying);
    22.  
    23.         _particleHolder.GetComponent<ParticleSystem>().Play();
    24.  
    25.         Debug.Log("_particleHolder.isPlaying after: " + _particleHolder.isPlaying);
    26.     }
    27.  
    28.     // Update is called once per frame
    29.     void Update()
    30.     {
    31.  
    32.     }
    33. }
    34.  
     
    Last edited: Dec 8, 2017
  32. DoublePixelStudios

    DoublePixelStudios

    Joined:
    Feb 27, 2014
    Posts:
    97
    WOW.. just realized this post was from 2015 :confused:
     
  33. michal990909

    michal990909

    Joined:
    Dec 15, 2017
    Posts:
    1
    I found the solution, and it's to simply change particle system name in script and then put it in inspector once again. Maybe it helped only me but maybe it's global solution :confused:
     
  34. ShyshyDai

    ShyshyDai

    Joined:
    Jun 27, 2017
    Posts:
    8
    Code (CSharp):
    1.         ps.Simulate(1,false,false);
    2.         ps.Play();
    I did it and it works, but only the parent and the children have no reaction. Anyone can help?
     
  35. shangkeyun

    shangkeyun

    Joined:
    Sep 4, 2018
    Posts:
    1
    I came across the same issue and solved it by querying the game object directly.

    Code (CSharp):
    1. var holder = GameObject.Find("ParticleSpawn");
    2. var particle = holder.GetComponentInChildren<ParticleSystem>();
    3. particle.Play();